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

How does one create a cool down for remote events on the server side?

Usually, you can set a local variable to determine whether a cool down is in action and so on preventing players from spamming an event, however exploiters can bypass this and fire the event many times a second, how could I possibly implement a cool down within the server that is specific to that one player and not the rest?

1 answer

✓ Accepted answer

A Table can be used to do so.

local Cooldown = {}



script.Parent.Touched:Connect(function(hit)

if hit and hit.Parent then
local Character = hit.Parent
if not Cooldown[Character] == false then return end ---If the Character is not in the table, then continue.
Cooldown[Character] = true ---Adds the Character to the table
wait(5)
Cooldown[Character] = false
end
end)

If the Player is not in the table, then add them to it. If they are in the table, then the script will ignore the rest

1 comment

0

perfect thank you!

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