Server side remote event cooldowns

I’m using remote events for certain things that have a cooldown, but since you can’t always trust the client, I’m trying to have some additional cooldown checks on the server. However, in my experience, when I try to make a cooldown in the server script remote event handler, the cooldown is set for everyone, not just for the specific player. If I instead set the cooldown with a coroutine, will it then work?

To put in context, the remote event passes in the cooldown length when it is fired, and then it uses a coroutine to wait. Will this work (as in not create a global cooldown on accident, and only apply to the specific player?)?

store the cooldowns for each player individually instead of a single one. there is only one remoteevent on the server so every time it fires it will fire the same connections. a coroutine would not fix this as connections are already run without blocking other code

What exactly do you mean by storing cooldowns for each player individually? I should have mentioned, the way I have the cooldowns done is by putting the player in a “cooldown table” and if they try to use the move again when their name is still in the table, it won’t let them. Is that what you mean?

does this “cooldown” table have a cooldown for each player or does it have a cooldown shared between everyone? what I mean by storing one for each player individually is structuring a table so that you can index it with the player instance / name and get a unique cooldown timer for that specific player.

use a table,

cooldowns = {}
remoteevent.OnServerEvent:Connect(function(player)
   if not cooldowns[player.UserId] then
     cooldowns[player.UserId] = tick()
   else
     if tick - cooldowns[player.UserId] >= cooldown then

     else
        return
     end
   end
end)

as @junekept said

So, instead of doing this, I could make it a dictionary, where the key is the name and the value is the tick() time? Would that be right?

Yes! ( 30 string limit rcvrehterdsv )