I do cooldowns in local scripts

Hello, i am making a game with abilities that have cooldowns. I want to know if their was anything wrong with using cooldowns in a local script (debounce). For example:

debounce = true

wait(0.5)

debounce = false.

could a player Manipulate this cooldown and make it 0 seconds, meaning they have no cooldowns or could players not alter local script code?

1 Like

Yes they could, an exploiter is able to make the wait(0.5) turn into wait(0) with ease. You should really be handling cooldowns on the server, the client should always REQUEST to do an ability, it should never do one on its own. I would suggest handling cooldowns on the server with os.time() (or os.clock apparently), this would make it impossible to exploit your abilities.

1 Like

alright this is good because i just recently started converting cooldowns to server. Youtube tutorials always show cooldowns being done on client so im guessing a lot of people get confused, also after a certain amount of time i fire client, which stops the cooldown. Is this a good idea?

by this i mean their is an on server event that when connected to, sets debounce = to false

I’m not entirely sure what you mean, but if you’re talking about telling the client to stop their cooldown on the server, then yes, this is a pretty bad idea. Again, you should just continue using cooldowns on the server, remember that an exploiter can break ANYTHING thats on the client.

game.Lighting.Quirks.Somnambulist.GasFist.Throw.OnClientEvent:Connect(function()
	debounce = false
	active = false
end)

server would fire out the remote event after some time connecting to this

also how would i go about using os.time()

Simple, just call os.time() and you get the current amount of seconds that have passed since the Epoch timestamp, look up the documentation.