I’m trying to teleport to a private server using TeleportToPrivateServer, but I keep getting the error must be passed an array of players.
I also searched forums and devhub to find the cause, but couldn’t solve it.
This is a script (not a local script).
Please Help.
local function LPCC_UP_UI()
local LPCC_FRAMES_A = {}
for i, LPCC_VALUE in pairs(game.ReplicatedStorage.Servers:GetChildren()) do
local LPCC_N = LPCC_VALUE.Name
local LPCC_SS = string.split(LPCC_VALUE.Value, " ")
local LPCC_ID = LPCC_SS[1]
local LPCC_PLRS = LPCC_SS[2]
local LPCC_FRAME_B = script.ServerTemplate:Clone()
LPCC_FRAME_B:WaitForChild("ServerName").Text = LPCC_N .. "\n ID: " .. LPCC_ID
LPCC_FRAME_B:WaitForChild("Players").Text = LPCC_PLRS .. "/" .. game.Players.MaxPlayers
table.insert(LPCC_FRAMES_A, LPCC_FRAME_B)
LPCC_FRAME_B.JoinButton.MouseButton1Click:Connect(function(player)
game:GetService("TeleportService"):TeleportToPrivateServer(game.PlaceId, LPCC_ID, {player}) -- error
end)
script.Parent.LPCC_FRAME_LIST:ClearAllChildren()
script.UIListLayout:Clone().Parent = script.Parent.LPCC_FRAME_LIST
for i, LPCC_FRAME_B in pairs(LPCC_FRAMES_A) do
LPCC_FRAME_B.Parent = script.Parent.LPCC_FRAME_LIST
end
end
end
LPCC_UP_UI()
game.ReplicatedStorage.Servers.ChildAdded:Connect(LPCC_UP_UI)
game.ReplicatedStorage.Servers.ChildRemoved:Connect(LPCC_UP_UI)