Scripting Helpers is winding down operations and is now read-only. More info→
Log in to vote

How to create a tool cooldown server-side?

Asked by
trecept 367 Moderation Voter
4 years ago

I'm creating a tool that I want the user to only be able to use every 2 seconds (as a cooldown), and for a client cooldown I would just wait(2) before firing the remote, but that's a bad practice for exploiters. I can't create a cooldown for the remote as it would act as a cooldown for all players, so how would I go about creating the cooldown on the server?

Does it really matter? And doing a cool down server side would be worse. Because then there's that little delay sending things to the other side of the network. That delay looks really ugly. The internet is not instant and therefore it will take time. By the time the server gets to the remotes the cool down could have already ended and they could spam the tool. A client cool down would be more imm User#24403 69 — 4y

1 answer

Log in to vote
Answered by 1 year ago

I found an easier way than using debounce, and much more simpler. You basically make the tool only manually activate for the amount of seconds for the cooldown. Here is my example.

Local tool = script.Parent
    tool.ManualActivationOnly = true
    ShootFireball() -- put shooting fireball here--
    tool.ManualActivationOnly = false

It will make the tool only activate if you use code to activate for 2 seconds. You won't be able to shoot the fireball in that 2 second interval.


Answer this question