BoolValue not working

I only want the client to see if its value is true or not, but it isnt changing at all do you know what the problem could be?

local AttackingBool = DataFolder:FindFirstChild("Attacking")

Tool.Activated:Connect(function()
    if not on then return end
    if CanAttack == true then
        AttackingBool.Value = true
        CanAttack = false
        SwingAnim()
        wait(0.5)
        AttackingBool.Value = false
        CanAttack = true
    end
end)

if “CanAttack” is a var, thats the reason its not working

lets say that you want change a bool value

what you’re trying to do is the same thing as:

true = false

if true then false end

local true = true

true = false

so make it the AttackingBool.Value instead of a variable

also it wont change for the server (it’ll just change for the client, the local player) if it is a local script so you may have to use remote events :slight_smile:
you can also make it a server script, the Activated event of tools isnt client only so you can make it a server script and change the value by that, do not forget to use

AttackingBool.Value = true

delay(.2, function()
    AttackingBool.Value = false
end)

Do CanAttack.Value instead so it can look at the value instead. If you keep it like this, it will always be true since it exists.

1 Like