timer.performWithDelay not delaying?

I’ve been trying to trouble shoot this problem for 2 hours now and I don’t know what I’m doing wrong, I’ve literally copy and pasted every example code snippet into my program to get it to work. Please, does anyone have any ideas what I’m doing wrong? I’m unsure if I’ve ever had the timer working correctly for me.

local function removeStuff( event )
MainGuy.isVisible = false
end
timer.performWithDelay(5000, removeStuff)

Honestly… it can’t get any simpler than this, and I’ve tried putting my event function everywhere in my program and also making it local and global, its so frustrating.

Thanks guys in advance. [import]uid: 215209 topic_id: 36267 reply_id: 336267[/import]

The problem is that it fires instantly with no delay, so I know it’s working but that doesn’t make any sense.

Well if anyone knows what the problem could be that’d be great. I finally just used the os.time() and a variable to wait the designated time in seconds. It works, but I’d like to know why I couldn’t do it with the timer. [import]uid: 215209 topic_id: 36267 reply_id: 144057[/import]

can you post more code? [import]uid: 199310 topic_id: 36267 reply_id: 144063[/import]

Could it be that you calling the function ( with parenthesis ) like this:
timer.performWithDelay(5000, removeStuff() )

instead of a pointer like this:
timer.performWithDelay(5000, removeStuff )

This happens to me sometimes and it’s usually me just passing a call to the function instead of a pointer to it. What happens in this case is that the function is called and the return value is passing to performWithDelay instead of the function itself (which is called immediately)

[import]uid: 80469 topic_id: 36267 reply_id: 144146[/import]

1 Like

The problem is that it fires instantly with no delay, so I know it’s working but that doesn’t make any sense.

Well if anyone knows what the problem could be that’d be great. I finally just used the os.time() and a variable to wait the designated time in seconds. It works, but I’d like to know why I couldn’t do it with the timer. [import]uid: 215209 topic_id: 36267 reply_id: 144057[/import]

can you post more code? [import]uid: 199310 topic_id: 36267 reply_id: 144063[/import]

Could it be that you calling the function ( with parenthesis ) like this:
timer.performWithDelay(5000, removeStuff() )

instead of a pointer like this:
timer.performWithDelay(5000, removeStuff )

This happens to me sometimes and it’s usually me just passing a call to the function instead of a pointer to it. What happens in this case is that the function is called and the return value is passing to performWithDelay instead of the function itself (which is called immediately)

[import]uid: 80469 topic_id: 36267 reply_id: 144146[/import]

The problem is that it fires instantly with no delay, so I know it’s working but that doesn’t make any sense.

Well if anyone knows what the problem could be that’d be great. I finally just used the os.time() and a variable to wait the designated time in seconds. It works, but I’d like to know why I couldn’t do it with the timer. [import]uid: 215209 topic_id: 36267 reply_id: 144057[/import]

can you post more code? [import]uid: 199310 topic_id: 36267 reply_id: 144063[/import]

Could it be that you calling the function ( with parenthesis ) like this:
timer.performWithDelay(5000, removeStuff() )

instead of a pointer like this:
timer.performWithDelay(5000, removeStuff )

This happens to me sometimes and it’s usually me just passing a call to the function instead of a pointer to it. What happens in this case is that the function is called and the return value is passing to performWithDelay instead of the function itself (which is called immediately)

[import]uid: 80469 topic_id: 36267 reply_id: 144146[/import]

The problem is that it fires instantly with no delay, so I know it’s working but that doesn’t make any sense.

Well if anyone knows what the problem could be that’d be great. I finally just used the os.time() and a variable to wait the designated time in seconds. It works, but I’d like to know why I couldn’t do it with the timer. [import]uid: 215209 topic_id: 36267 reply_id: 144057[/import]

can you post more code? [import]uid: 199310 topic_id: 36267 reply_id: 144063[/import]

Could it be that you calling the function ( with parenthesis ) like this:
timer.performWithDelay(5000, removeStuff() )

instead of a pointer like this:
timer.performWithDelay(5000, removeStuff )

This happens to me sometimes and it’s usually me just passing a call to the function instead of a pointer to it. What happens in this case is that the function is called and the return value is passing to performWithDelay instead of the function itself (which is called immediately)

[import]uid: 80469 topic_id: 36267 reply_id: 144146[/import]