# SetAttribute

**Example Usage:**

{% tabs %}
{% tab title="Script" %}

```lua
-- Getting ReplicatedStorage and Workspace service
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local workspace = game:GetService("Workspace")

-- Referencing Essentials
local Essentials = require(ReplicatedStorage.Essentials)

-- Referencing the instance you want to set the attribute to
local damagePart = workspace.DamagePart

-- Setting the attribute and it's value
Essentials.SetAttribute(damagePart, "Damage", 50, true)
```

{% endtab %}

{% tab title="Output" %}

```
Essentials: Successfully set damagePart's attribute name to Damage and the attribute value to 50
```

{% endtab %}
{% endtabs %}

### Parameters

#### instance: [Instance](https://create.roblox.com/docs/reference/engine/datatypes/Instance)

The instance you want the attribute to be assigned to.

#### attributeName: [string](https://create.roblox.com/docs/luau/strings)

The name of the attribute.

#### attributeValue: [any](https://create.roblox.com/docs/studio/instance-attributes#supported-types)

The value type of the attribute.

#### debugging: [bool](https://create.roblox.com/docs/luau/booleans)

Sends an output log to your output window and developer console.

### References

#### [Instance Attributes](https://create.roblox.com/docs/studio/instance-attributes)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://synilla.gitbook.io/essentials/reference/functions/general/setattribute.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
