Debounce time on a button GUI

Hello,I am currently creating a clicking simulator game but I have a little problem. I made a button gui where you can click on it to gain stats but I don’t want peopoles to spam it with an autoclicker so I made a debounce time. Here’s the script :

local x = require(game.ReplicatedStorage.BigNum) -- Ignore, just a script for better stats
local debounce = false

script.GetClick.OnServerEvent:Connect(function(plr)
	if not debounce then
		debounce = true
		local leaderstats = plr:WaitForChild("leaderstats")
		leaderstats.Steps.Value = x.bnumtostr(x.add(x.convert(leaderstats.Steps.Value), x.convert(1)))
		wait(0.384)
		debounce = false
	end
end)

For now, the debounce time is working correctly but I want to know if I can make a script where the person can not even click the button. For now, when I click the button with an auto clicker, the color of the button changes to a lighter color but the person don’t get the stat. I want that the person can’t even click it. I don’t know if you can understand me correctly but I hope someone can help me about that :happy1:

Have a great day !!

I can’t quite understand, Do you want it so the player cant click the textbutton after a certain amount of times?

No, when you click a text button, the background color changes to a lighted color. I want to make that every like 1 second, the button can’t be clicked so the background color doesn’t go lighter. I will try to send you some images of what I mean.

Not Clicked

Not Cliked

Clicked

Clicked
See, the color of the background is lighter…

You could achieve that effect by setting the AutoButtonColor property to false.

1 Like

Thanks, it worked perfeclty :happy4:

1 Like