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

Invalid list of players to teleport error, how do I fix this?

In my code to teleport players from a main game to a place connected to the main experience I have a "Invalid list of players to teleport." error. How do I fix this?

local teleport = game.ReplicatedStorage:WaitForChild("Teleportplayer") local teleportservice = game:GetService("TeleportService") local placeId = 11905398683 local players = game:GetService("Players") local player = players:GetPlayers()[1]

teleport.OnServerEvent:Connect(function() teleportservice:TeleportAsync(placeId,{player}) end)

2 comments

0

I don't know but for some reason my text was misformatted when copying and pastying, however it is properly formatted in the script.

0

Perhaps 'player' is nil. As you're declaring it at the start of the script, the player may not be loaded; try printing 'player' and see what it prints.

1 answer

The player was not yet loaded, if you put a wait(let's say 5) this gives the player enough time to load.

1 comment

0

It would be better to put the player inside the event and check if it is not nil, instead of adding a wait.

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