Hi. can someone help me with a spam filter? can someone do so if they spam click, it only redeems 1 click per second?
script: script.Parent.MouseClick:Connect(function(player) if player:FindFirstChild("leaderstats") and player.leaderstats:FindFirstChild("Cash") then player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 25 end end)
I am assuming that you meant "Cooldown", Well then, you should use a boolvariable with an if statement!
local bool = true script.Parent.MouseClick:Connect(function(player) if bool == true and player:FindFirstChild(“leaderstats”) and player.leaderstats:FindFirstChild(“Cash”) then bool = false player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 25 wait(1) -- cooldown bool = true end end)
After the MouseClick
event, it will do what u want it to do and wait for 1 second for it to work again.
script.Parent.MouseClick:Connect(function(player) if player:FindFirstChild(“leaderstats”) and player.leaderstats:FindFirstChild(“Cash”) then player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 25 wait(1) -- Change this to whatever number you would like end end) --If this doesn't work please tell me
how about:
debounce = false script.Parent.MouseClick:Connect(function(player) if not debounce then debounce = true if player:FindFirstChild(“leaderstats”) and player.leaderstats:FindFirstChild(“Cash”) then player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 25 wait(1) debounce = false end end end)