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

How do I loop this script with playing every 20 seconds?

I need help looping this script to play every 20 seconds. I have tried stuff like

while true do

but still doesn't work.

wait(33)
local p = game.Players:GetChildren()
for i = 1, #p do
p[i].Character:MoveTo(Vector3.new(531, 159, 451))
end

This script teleport players every 33 players. Expect it only does it once.

Someone help and thanks.

2 comments

0

plz du sum research next time. c:

1 answer

✓ Accepted answer

you can do

local p = game.Players:GetChildren()
while wait(33) do
	for i = 1, #p do
	p[i].Character:MoveTo(Vector3.new(531, 159, 451))
end

not sure if thats what ur trying to say?

8 comments

0

No, what I'm looking is the script to loop every 20 seconds.

0

You should change the answer to "I cant script spoonfeed me plz". If you had any idea how to script that loop plus table iteration, and things like MoveTo() you would know how to use a wait statement.

0

I thought this was a place to get help with roblox scripting?

0

then change the 33 to 20? also you said, "This script teleport players every 33 players." not sure what you are trying to say.

0

So the 33 is the seconds it takes to teleport to player. You see, the player has to go to an obby where they have to do it before the timer. Yes it will play every 33 seconds, but I need it to go on loop so every round the players will be teleported.

0

sorry man, not sure if you want 20 or 33 seconds now im confused haha :p

0

You know what nvm.

0

lol, sorry xD just confused is all.

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