Attributes allow you to customize instances with your own data. They are similar to built-in object properties, but you can create and modify your own attributes for any instance. Key features include:
- Attributes can be created, edited, and deleted directly within Studio's Properties window.
- Attributes and their values are saved with your place and assets.
- Value changes can be viewed in real time and are replicated so that clients can access them immediately.
Specific examples of attribute usage include:



Supported Types
You can store the following types/values in attributes:
Studio Usage
New attributes can be created and modified in Studio as follows:
Select the instance, scroll to the bottom of the Properties window, and click Add Attribute.
In the popup window, enter the attribute Name, select its Type, and click Save.
The new attribute will appear with a default value that you can change just like any other property.
If necessary, you can rename or delete an attribute by clicking the gear icon.
Scripting
Attributes can also be created and controlled through scripts.
Creating/Modifying Attributes
To create an attribute or modify an existing attribute's value, call Instance:SetAttribute() with a name and value.
Create or Modify Attribute
local weapon = script.Parent-- Create an attributeweapon:SetAttribute("ReloadTime", 3)
Getting Attribute Values
To get the value of one existing attribute, call Instance:GetAttribute() on the instance.
Get Attribute Value
local weapon = script.Parent-- Create an attributeweapon:SetAttribute("ReloadTime", 3)-- Get current attribute valuelocal reloadTimeValue = weapon:GetAttribute("ReloadTime")print(reloadTimeValue)
Similarly, you can get all attributes of an instance by calling Instance:GetAttributes(). This returns a dictionary of string/variant pairs representing each attribute.
Get All Attributes
local weapon = script.Parent-- Create attributesweapon:SetAttribute("ReloadTime", 3)weapon:SetAttribute("FireSound", "rbxassetid://3821795742")-- Get all instance attributeslocal weaponAttributes = weapon:GetAttributes()for name, value in pairs(weaponAttributes) doprint(name, value)end
Deleting Attributes
To delete an attribute, call Instance:SetAttribute() with a value of nil.
Delete Attribute
local weapon = script.Parent-- Delete an existing attributeweapon:SetAttribute("ReloadTime", nil)
Detecting Attribute Changes
To listen for value changes on one or more attributes:
- Connect Instance:GetAttributeChangedSignal() for one specific named attribute.
- Connect Instance.AttributeChanged for any attribute on the instance.
Listen for Change on Attribute(s)
local weapon = script.Parent
--- Listen for one specific attribute change
weapon:GetAttributeChangedSignal("ReloadTime"):Connect(function()
print(weapon:GetAttribute("ReloadTime"))
end)
-- Listen for any attribute change on the instance
weapon.AttributeChanged:Connect(function(attributeName)
print(attributeName, weapon:GetAttribute(attributeName))
end)