There are indeed no timers in Lua, but we have added this functionality for the game. You can create a timer this way:
[lua]setTimer(function, interval, repeats, [arguments]);[/lua]
"function" is the targetfunction that will be triggered by the timer, "interval" is the interval of the timer in seconds (i.e. the delay), "repeats" specifies how often the function should be triggered (use 1 for a single trigger, -1 for infinite) and "arguments" are optional, these are the arguments for your function (if any arguments are required).
Here is an example for displaying a label when a player connects and removing it after 5 seconds
[lua]function onPlayerSpawn(event)
local label = Gui:createLabel("Welcome to "..getServer():getServerName().."!", 0.98, 0.135);
label.setPivot(1);
setTimer(destroyLabel, 5, 1, event, label);
end
function destroyLabel(event, label)
event.player:removeGuiElement(label);
Gui:destroyElement(label);
end[/lua]
Of course you can directly define a new function when calling the timer, allowing you to access all variables inside the same block:
[lua] setTimer(function()
event.player:removeGuiElement(label);
Gui:destroyElement(label);
end, 5, 1);[/lua]