I want this tool to not be able to fire if one of the 3 attributes is currently true (attacking, blocking, stunned) but it doesn’t work. Can anybody help me fix it?
This is the local script
local uis= game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
plr.CharacterAdded:Wait()
local remote = game.ReplicatedStorage:WaitForChild("Abilities").Events.kneeevent
local animation = game.ReplicatedStorage.Abilities.Anims.knee
local char = plr.Character
local hum = char:WaitForChild("Humanoid")
local debounce = false
local cd = 5
local tool = script.Parent
local stunned = char:GetAttribute("Stunned")
local stun = false
local blocking = char:GetAttribute("Blocking")
local block = false
local attacking = char:GetAttribute("Attacking")
local attack = false
while task.wait() do
if stunned == true then
stun = true
else
stun = false
end
if blocking == true then
block = true
else
block = false
end
if attacking == true then
attack = true
else
attack = false
end
end
tool.Activated:Connect(function()
if attack or stun or block then return end
if not debounce then
debounce = true
local track = hum:LoadAnimation(animation)
track:Play()
remote:FireServer()
wait(cd)
debounce = false
end
end)