Add attribute through instance.new?

Roblox has this feature of adding attributes in an object, how would I do this when I make an instance and I want to add attributes?

local foo = Instance.New("BoolValue")

-- adding a string property to foo or something
1 Like

You can use this script, for example:

local foo = Instance.new("BoolValue")
foo:SetAttribute("Attribute", 3) --"Create an attribute called Attribute with value 3"
16 Likes