I need some help using this os.Time thing
#1
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]
Reply
#2
[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).
Reply
#3
Thank you.
Reply
#4
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.
Reply
#5
Well I'd rather PM them to you than put them on the forums, is that fine?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)