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?
✓ ANSWER ACCEPTED
How do I use debounce correctly in this script?
1 answer
✓ Accepted answer
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)
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Yeah, negative negative is positivr.
i removed not but i can still spam the hell out of it
Ah I missed the nested function let me edit it