Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

ppl can use autoclicker so i need a cool down, can anyone remake the script with a cooldown?

script.Parent.Activated:Connect(function()
local char = script.Parent.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
local leaderstats = plr:FindFirstChild("leaderstats")
if leaderstats then
		local coins = leaderstats:FindFirstChild("IceCream") --// YOUR CURRENCY NAME!
		local boost = plr:FindFirstChild("CoinBoost")
		if coins and boost then
			coins.Value = coins.Value + 1 + boost.Value
		end
	end 
end)

2 answers

✓ Accepted answer

Here this shold work. U should do some research about cool downs and debounce:

script.Parent.Activated:Connect(function()
local char = script.Parent.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
local leaderstats = plr:FindFirstChild("leaderstats")
local debounce = true
if leaderstats and debounce = true then
        local coins = leaderstats:FindFirstChild("IceCream") --// YOUR CURRENCY NAME!
        local boost = plr:FindFirstChild("CoinBoost")
	debounce = false
        if coins and boost then
            coins.Value = coins.Value + 1 + boost.Value
		wait (--put the ammount of seconds u want the cool down to be here)
		debounce = true
        end
    end 
end)

If this doesnt work, then reply and i can help u :)

7 comments

0

Line 16 end) Line 6 if leaderstats and debounce == true then

0

oh yeah,

0

everyone can do mistake :p

0

its exactly the same i fixed it with the == but its still the same

0

Toastitions lemme give u that i fixed

0

just post the script in the answer page

0

Toastitions done

wait()
script.Parent.Activated:Connect(function()
local plr = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local char = plr.Character or plr.Characterded:Wait()
local leaderstats = plr:FindFirstChild("leaderstats")
local debounce = true
while wait() do
if debounce == true then
        local coins = leaderstats:FindFirstChild("IceCream")
		local boost = plr:FindFirstChild("CoinBoost")
        if coins then
		debounce = false
        coins.Value = coins.Value + 1 + boost.Value
        wait(5)
        debounce = true
			end
   		end
	end
end)

3 comments

0

it doesnt work but if fixed it nvm

0

for me work perfect, idk where u used the button.

0

Toastitions check any other scripts to see if they may be interfering with your code. Theres not much we can do to help. Try making a new game and using the script. If it works, then delete some scripts in ur normal game and see if it works.

This discussion is preserved as it was. New answers, comments, and votes are closed.