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?
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.Activated:Connect(function() tool.ManualActivationOnly = true ShootFireball() -- put shooting fireball here-- wait(2) tool.ManualActivationOnly = false end)
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.