Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-4

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

Asked by 6 years ago

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.

0
plz du sum research next time. c: TheeDeathCaster 2368 — 6y

Locked by OldPalHappy

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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?

0
No, what I'm looking is the script to loop every 20 seconds. jackalota 9 — 6y
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. H4X0MSYT 536 — 6y
0
I thought this was a place to get help with roblox scripting? jackalota 9 — 6y
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. PoePoeCannon 519 — 6y
View all comments (4 more)
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. jackalota 9 — 6y
0
sorry man, not sure if you want 20 or 33 seconds now im confused haha :p PoePoeCannon 519 — 6y
0
You know what nvm. jackalota 9 — 6y
0
lol, sorry xD just confused is all. PoePoeCannon 519 — 6y
Ad