I have a handler inside the player that determines certain values, like if the player is staggered or not. I want to be able to stop the sword from activating by checking the value inside the handler, but everything I've tried doesn't work. Does anybody know how I can make the sword check the value every time I try to attack with it?
Sword Script snippet:
-- On Click function onActivation() if Equipped == true and Attacked == false and Tool.Parent.Humanoid.Health > 0 then if Tool.Parent.Handler.ToolEnabled.Value == true then Tool:WaitForChild("Attack".. AttackNum).Value = not Tool:WaitForChild("Attack".. AttackNum).Value if AttackNum == 5 and AttackDecay > 0 then AttackNum = 2 else AttackNum = AttackNum + 1 end HumanoidTakeDamage() Attacked = true wait(HBDelay) AttackS:Play() HitBox = true Trail.Enabled = true wait(AttackTime) HitBox = false Trail.Enabled = false Attacked = false AttackDecay = 1 end end end ----------- -- Equipped function onEquipped() EquipS:Play() wait(EquipTime) Equipped = true end ----------- Tool.Equipped:Connect(onEquipped) Tool.Activated:Connect(onActivation)
EDIT: The problem was that I was defining the value of each status and then checking the value already defined, and not the value that it was currently.