Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Would this be suitable to wait for 10 seconds?

Would this be suitable and efficient? Or would it be just laggy?

start = tick()
end = tick()
while start - end ~= 10 then
	wait()
	end = tick()
end
print("10 seconds!")

2 comments

0

Just use wait(10).

2

you can't use "end" as a variable name.

1 answer

✓ Accepted answer

There is only one small problem with this, What if the line "start - end ~= 10" is bigger than 10 or skips over 10 seconds.

You probably would also want this as part of a function:-

function chkTime(startTime, limit)
	return tick() - startTime <= limit -- this will return true or false which will be used for the while loop
end

local curTime = tick()
while chkTime(curTime, 10) do wait() end

print('ended')

Hope this helps

This discussion is preserved as it was. New answers, comments, and votes are closed.