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

Is their a way to wait for a player to teleport before script keeps running?

Asked by 6 years ago

I have 2 problems here is the relevant code:

local TeleportService = game:GetService("TeleportService")
 local level1Id = 1564858890

function MovePlayers ()

    local players = script.Parent.Parent.Parent.PlayerNames:GetChildren() -- where i keep a bunch  of values that have the names of players

    for i = 1, #players do
        local player = game.Players:FindFirstChild(players[i])
        TeleportService:Teleport(level1Id, player)
    end 
end



local Count = 75

while true do
if Count > 0 then
MovePlayers()
end
end

One is it apparently cant find the player which is weird. because all the values are named after the player.

Also i need a wait after it sends the group of players because it keeps doing it every second. but i want to add a wait in the function so that the script waits until the batch of players are sent before running the script again

0
Try changing line 9 to "local player = game.Players:FindFirstChild(players[i].Name)" Optimalpokemon123 37 — 6y

Answer this question