[Urgent!] Why are my timers broken?

Hello All,
Every time I try to use a timer to say run an idle check function every 2 seconds, or something else, it always ends up working.
The problem is, is that the console spits out the following error in the picture.

Yet it works!? What the heck. Solutions?
I have less than 24 hrs to fix what I am working on, so please help! :frowning:

Why have you posted an image of your error and code…

Why didn’t you just use [lua] tags?

timer.Create(“idlecheck”, 2, 0, CheckIdle(ply))

First thing, I believe timer identifiers have to be unique so you’re overwriting timers for other players.
Second you’re not actually passing the CheckIdle function, you’re passing the return value of calling CheckIdle(ply)

Something like this would be an improvement however creating a new timer in a StartCommand hook still seems like a bad idea for this

timer.Create(“idlecheck” … ply:EntIndex(), 2, 0, function() CheckIdle(ply) end)

timer.Create("idlecheck", 2, 0, function()
for _, ply in pairs(player.GetAll() do

^ the best solution for what OP wants

id also like to add that to call a function directly from a timer you need to omit arguments like so

 timer.Create("idlecheck", 2, 0, CheckIdle) 

(obviously won’t work in this case as the function relies on having a player entity input into it, however if you built that for loop into the actual function and made it not have any inputs it would work fine)