Set Attribute
Set or update an attribute value on a Roblox instance. Supports primitive types (string, number, boolean) and complex types (Vector3, Color3, UDim2, BrickColor).Parameters
Roblox instance path using dot notation (e.g.,
"game.Workspace.Part")Name of the attribute to set (max 100 characters)
Value to set. Type depends on the data:
- Primitives:
string,number,boolean - Vector3:
{X: number, Y: number, Z: number} - Color3:
{R: number, G: number, B: number}(0-1 range) - UDim2:
{X: {Scale: number, Offset: number}, Y: {Scale: number, Offset: number}} - BrickColor:
string(BrickColor name)
Optional type hint for complex types:
"Vector3", "Color3", "UDim2", "BrickColor"Response
Returns confirmation object:Supported Types
Primitives
- string — Text values (max 1024 characters)
- number — Integers or floats
- boolean —
trueorfalse
Vectors
- Vector3 — 3D position/size:
{X: 0, Y: 5, Z: 10} - Vector2 — 2D coordinates:
{X: 100, Y: 200} - UDim — UI dimension:
{Scale: 0.5, Offset: 10} - UDim2 — UI size/position:
{X: {Scale: 1, Offset: 0}, Y: {Scale: 0.5, Offset: 20}}
Colors
- Color3 — RGB color (0-1 range):
{R: 1, G: 0, B: 0}for red - BrickColor — Roblox palette color:
"Bright red"
Special
- NumberRange — Min/max range:
{Min: 0, Max: 100} - Rect — 2D rectangle:
{Min: {X: 0, Y: 0}, Max: {X: 100, Y: 100}}
Example Usage
Set Primitive Attributes
Set Vector3 Attributes
Set Color3 Attributes
Set UDim2 Attributes
Use Cases
Weapon Configuration
Store damage, fire rate, magazine size, and reload time on weapon models.NPC Behavior
Save AI parameters like aggression level, patrol radius, and detection range.Level Progression
Mark checkpoints with level numbers, unlock requirements, and completion flags.Environmental Effects
Store effect parameters (particle colors, light intensity) on environmental objects.Dynamic UI
Save original UI positions and sizes before animations for reset functionality.Batch Operations
For setting attributes on multiple instances, combine withmass_set_property patterns:
Error Handling
- Throws error if
instancePathis invalid or instance doesn’t exist - Throws error if
attributeNameexceeds 100 characters - Throws error if
attributeValuetype is unsupported - Throws error if Vector3/Color3 format is invalid
Related Tools
Get Attribute
Read a single attribute value
Get Attributes
Get all attributes on an instance
Delete Attribute
Remove an attribute from an instance
Notes
- Attributes are replicated from server to client automatically
- Attribute changes fire
Instance:GetAttributeChangedSignal()in Lua - Attributes are visible and editable in Studio’s Properties panel
- Setting an existing attribute overwrites its value
- Attributes persist when saving the game file