Your issue with that is, that it will run once (when you login or update the script) and won't work after, you need to have a loop like so:
PHP Code:
//#CLIENTSIDE
function onCreated() {
setTimer(0.05);
}
function onTimeout() {
// do stuff
// continue looping
setTimer(0.05);
}