So for example, I have an attribute named A right? A = true, but in an if and else how would I detect if A is true and then set A to false.
Use Instance:GetAttribute() and :SetAttribute()
such as:
local part = workspace.part
if (part:GetAttribute("bool") == true and part:GetAttribute("int") > 0) then
part:SetAttribute("bool", false)
part:SetAttribute("int", 5352597252978)
end
Are you sure (part:GetAttribute("bool")
is correct or is that an error on your part, I don’t remember there being a ( infront of the attribute, correct me if I’m wrong.
Oh, I’m sorry I did make a mistake, I forgot to close the if statement lol
if (part:GetAttribute("bool") == true and part:GetAttribute("int") > 0) then
also the parentheses after the if isn’t required, it’s just a habit i picked up due to multiple other languages requiring them.
if part:GetAttribute("bool") == true and part:GetAttribute("int") > 0 then
would also work
Alright, SetAttribute on the bool isn’t working for some reason, but thank you.
Actually wait, so basically the “enabled” attribute on my thing exists right? But part:SetAttribute("enabled", false)
doesn’t seem to change it to false when I test it.
Ah well that sucks, I don’t have too much experience with attributes. lol. Maybe look at the articles for them: Instance | Roblox Creator Documentation Instance | Roblox Creator Documentation