How to check an atribute?

I want to check if a Boolean attribute is true or false in an if statement if possible.
how do i do this.


Use Instance:GetAttribute(string) to do this and Instance:SetAttribute(string,value) to set an attribute.

I misread the post and skimmed too fast whoops

I believe you could just use the GetAttributeChangedSignal if you’re wanting to detect when a value changes

script.Parent:GetAttributeChangedSignal("BoolValue"):Connect(function()
    local CurrentValue = script.Parent:GetAttribute("BoolValue")

    if CurrentValue then --Checking if it's true or false
         --This would be true
    else
        --This would be false
    end
end)
6 Likes

Or use GetAttributeChangedSignal

I do not know these modern ROBLOX things okay reee

I know I know, I felt the same pain and suffering when Roblox had both JumpHeight and JumpPower :joy:

1 Like