How to set attribute type

I’m learning on how to use attributes but I’m unsure on how to set the type. The wiki for it doesn’t explain how to change the type for some reason.
stats:SetAttribute("Exp",number)

1 Like

You can just set the attribute to the new type. The first argument you provide is the key, or name of the attribute (whatever you would like to name it with a few restrictions). And the second is the value you would like to store at that key (variant type) which means it can be any supported type (basically anything besides an object reference)

1 Like

so how am I suppose to do it? do I do it with “” or what?

Say you want to store a number type at the attribute key “Exp”. You need to provide some default value for this attribute to be set to:

stats:SetAttribute("Exp", 0) --You can change that 0 to be any number
3 Likes

OHHHHHHHHHH Thank you that make sense

so if you were to do SetAttribute(“Exp”, true) it would automatically make it a bool attribute? That part is not clear to me…how would it know whether to make string or bool etc.

1 Like

yes it would automatically convert it