Help with queueing system

So I’m trying to make a queueing system for a horror game, but it keeps saying,
“Invalid player to teleport. The invalid instance name is Werx7499.”

Here is the code:

local TeleService = game:GetService("TeleportService")
local PlaceId = 135278317068582

script.Parent.CountDown.Start.Event:Connect(function()
	local Players = {}
	
	for i, Plr in ipairs(script.Parent.Parent.Player:GetChildren()) do
		table.insert(Players, Plr)
	end
	local ServCode = TeleService:ReserveServer(PlaceId)
	TeleService:TeleportToPrivateServer(PlaceId, ServCode, Players)
end)

For context, the Player thing in the for, i, plr in ipairs thing is a folder which contains the players in the lobby

1 Like

You must pass an array filled with the actual player objects, you are passing (what I assume to be) their characters.

local PlayersService = game:GetService("Players")
for i, Plr in ipairs(script.Parent.Parent.Player:GetChildren()) do
	table.insert(Players, PlayersService:GetPlayerFromCharacter(Plr))
end
1 Like

Okay, thank you for the help! It works great!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.