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

Reserve server players ending up in the same server?

Asked by 3 years ago

So I am trying to make a lobby which teleports the players who are in a tube into the same server using reserve server. The way I'm trying to do it, and correct me if this is horrid, but I have a remotevent which fires to the client, back to the server, creates a table of all the players and teleports them. This does work but then a new player teleports, he gets put in the same game as the previous players. I do not receive error codes, or any sort of warning.

This is the teleporting script:

local teleportService = game:GetService("TeleportService")
local code = teleportService:ReserveServer(6879552528)
local teleportPlace = 6879552528


script.Parent.TeleportingEvent.OnServerEvent:Connect(function(player)
    local Playerr = {}
    table.insert(Playerr, player)
    teleportService:TeleportToPrivateServer(teleportPlace,code,Playerr)
end)
0
Also when I print the number of players in that table, only 1 shows. SooGloezNoob 45 — 3y
0
you mentioned that you " have a remotevent which fires to the client, back to the server " , shouldn't you use a RemoteFunction instead? Gmorcad12345 434 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

You said only one player is printed in the print table, I think you should use an in pairs() loop to gather all the players and in each in pairs loop fire the RemoteEvent or RemoteFunction

Ad

Answer this question