Why the IsAttacking BoolValue's Value doesn't change?
Tool = script.Parent Damage = script.Parent.Settings.Damage local ButtonPressed = false Attacking = script.Parent.Scripts.IsAttacking Tool.Equipped:connect(function(Mouse) Mouse.Button1Down:connect(function() ---------------------------------------------------------------------- script.Parent.DamagePart.Touched:connect(function(hit) if not ButtonPressed then --is it not pressed? ButtonPressed = true Attacking.Value = true -- here -- -- if hit.Parent then local human = hit.Parent hum = human:FindFirstChild("Humanoid") if hum then hum.Health = hum.Health - script.Parent.Settings.Damage.Value else print("Humanoid Not Found") end wait(1) end -- Attacking.Value = false -- here ButtonPressed = false end end) --------------------------------------------------------------------- end) end)
That's because your Bool Value immediately sets to True whenever the Touched event fires, so it never changes.
Perhaps add a wait() before setting IsAttacking to false
Use a direct boolean instead of one located in the Workspace, like:
bool = true