Help with Timer

I am trying to set a timer so a player can not use the command again for X amount of time. I’ve been programming for 10 hours straight about time to call it a night, I’m sure this is a long shot but this is what I came up with so far:

local cooldown = false
local cooldownTime = 60

local CoolDownList = {}

concommand.Add ( "rtd", function(ply, cmd, args)
local outcome = table.Random(dice.outcomes)

	if !table.HasValue(CoolDownList, ply:SteamID() ) then
		cooldown = true
		GetID = ply:SteamID()
		table.insert(CoolDownList, GetID)
		cooldown = false

	timer.Simple( cooldownTime, function()
		cooldown = true
		 if table.HasValue(CoolDownList, GetID ) then
			table.remove(CoolDownList, GetID )

I think I have a problem with the timer and table.remove?

[ERROR] addons/rollthedice/lua/rtd/sv_rtd.lua:358: bad argument #2 to ‘remove’ (number expected, got string)

  1. remove - [C]:-1
  2. unknown - addons/rollthedice/lua/rtd/sv_rtd.lua:358

Timer Failed! [Simple][@addons/rollthedice/lua/rtd/sv_rtd.lua (line 355)]

table.remove expects a KEY value when removing something. So, you can do something like this:

[lua]table.remove( CoolDownList, table.KeyFromValue( CoolDownList, GetID ) );[/lua]

Hope this helps! If it resolved your question please feel free to mark this topic as solved in the upper left corner next to the reply button; otherwise please feel free to continue asking questions :slight_smile:

Woooohooooo it works, thank you so much man!