timer.Create - Error?

Hello everyone.

For the last hour I have been trying to figure out what is wrong with this timer?

The function:


local function PlayerSave ( ply )
	if (!IsValid(ply)) then
		timer.Stop(ourID);
		timer.Remove(ourID);
		return;
	end
			
	ply:Save();
end

timer.Create:


local ourID = Player:SteamID();
timer.Create(ourID, 60, 0, PlayerSave, Player);

The error I get:


bad argument #1 to 'Stop' <string expected, got nil>

I can’t really tell what the error would be? For me it looks like it should work okay?


local function PlayerSave( ply, ourID )
	if (!IsValid(ply)) then
		timer.Stop(ourID);
		timer.Remove(ourID);
		return;
	end
			
	ply:Save();
end


local ourID = Player:SteamID();
timer.Create(ourID, 60, 0, function() PlayerSave( Player, ourID ) end);

Thanks dude. :slight_smile: