How can I subtract or add attributes values?
You would use Instance:SetAttribute()
to set it.
There are no compound assignments with attributes unlike properties.
I tried set attribute but i want it to subtract its value from what it is.
States:SetAttribute("Stamina", States:GetAttribute("Stamina") - 1)
4 Likes
You would use Instance:GetAttribute()
with the respective mathematical operator then set that as the new value of the attribute.
1 Like
What you’re doing here is trying to modify a value that won’t be saved anywhere. Get methods usually have a twin Set method, so use :SetAttribute()
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.