How to make cooltime for command

!stuck -> ply:freeze(true) -> 5sec wait -> ply:SetPos(Vector(0,0,0)) -> can’t use !stuck command until after 5minute

how can i make 5 sec wait and cooltime for command?

One solution would be to check if a variable is true or false when the player types the command. If the variable is true, then run the command and set it to false, then use timer.Simple or timer.Create to set the variable back to true when five minutes is up.

Or set a variable with CurTime on the player and check if it has been 5 mins.

CurTime( ) - start > cooldown is the typical format. I actually made helper functions to do this…

Example of usage:


Hopefully these tutorials and information helps. As always, to view the Lua from any of my tutorials to enable copy/pasting ( HTML doesn’t copy/paste well in terms of HTML / CSS Highlighted Lua ), remove .html from the url.