Hey, I was trying to make my own party feature not for a game only for fun. Anyhow, I keep getting an error when I test it on a regular Roblox server that says I need to pass an array of players, but I did though with a table that I put the players in the party into. Here’s my code.
SERVERSCRIPT
local TS = game:GetService("TeleportService")
game.Players.PlayerAdded:Connect(function(player)
local inparty = Instance.new("BoolValue", player)
inparty.Name = "inParty"
end)
game.ReplicatedStorage.sendPlayers.OnServerEvent:Connect(function()
local players = {}
for i, player in game.Players:GetPlayers() do
if player.inParty.Value == true then
table.insert(players, player)
end
end
local serverCode = TS:ReserveServer(11717066798)
TS:TeleportToPrivateServer(11717066798, serverCode, players)
end)
wouldnt it be easier just to put the server code in the start of the script then teleport after the inparty check instead of adding it to a table then teleporting