anime = script.Parent.name.Value local gain = game.ReplicatedStorage.Remotes.GainPoint local Power = game.Players.LocalPlayer.leaderstats.Power local debounce = false script.Parent.Selected:connect(function(m) if not debounce == false then debounce = true m.Button1Down:connect(function() hum = game.Players.LocalPlayer.Character.Humanoid anim_feet = hum:LoadAnimation(script.Parent.Animation) current = anim_feet current:Play() game.ReplicatedStorage.Remotes.GainPoint:FireServer() wait(3) debounce = false end) end end) -- how do i use debounce correctly? no errors. my debounce attempt stops the script from working entirely what am i doing wrong?
Since the line
if not debounce == false then
is the equivalent to checking if debounce is true, simply remove the not
and it should work.
anime = script.Parent.name.Value local gain = game.ReplicatedStorage.Remotes.GainPoint local Power = game.Players.LocalPlayer.leaderstats.Power local debounce = false local selected game.Players.LocalPlayer:GetMouse().Button1Down:connect(function() if debounce == false and selected then debounce = true hum = game.Players.LocalPlayer.Character.Humanoid anim_feet = hum:LoadAnimation(script.Parent.Animation) current = anim_feet current:Play() game.ReplicatedStorage.Remotes.GainPoint:FireServer() wait(3) debounce = false end end) script.Parent.Selected:connect(function() selected = true end)