Posts: 1,586
Threads: 85
Joined: Apr 2011
Reputation:
0
I really don't understand how I can use it to replace sleep()
How can I do stuff like this with it?!
[lua]while sleep(10) do
sleep(0.05)
script.Parent.Rotation = 0
end
[/lua]
Posts: 5,683
Threads: 413
Joined: Aug 2012
Reputation:
0
[lua]
function waitFor(time)
local waittime = os.time()
while os.time() - waittime < time do
sleep(0.001)
end end
[/lua]
And then whenever you need to wait a bit, instead of sleep(10) use waitFor(10).
Posts: 2,843
Threads: 382
Joined: Jul 2012
Reputation:
0
Can you guys post the scripts you are using the waitfor() function in? sleep() for long periods doesn't cause problems by itself, but delaying the execution of an event handler does, and that is exactly what you're doing.
Posts: 1,586
Threads: 85
Joined: Apr 2011
Reputation:
0
Well I'd rather PM them to you than put them on the forums, is that fine?