So basically I have this game where you get queued up into a server with a party of up to 12
that works fine, but going through exit door sends you all to diff servers…
I really want all players in server to get teleported when one person exits
but no one can fix it for me… please fix?
heres it:
local telePart = script.Parent
local TeleportService = game:GetService('TeleportService')
local placeID = (13050238945)
local canTeleport = true
local FirstPlayer = true
local ReservedServerAccessCode = nil
local function otherGame(otherPart)
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if player and canTeleport then
if FirstPlayer == true then
ReservedServerAccessCode = TeleportService:ReserveServer(placeID)
FirstPlayer = false
end
canTeleport = false
TeleportService:TeleportToPrivateServer(placeID, ReservedServerAccessCode, {player})
wait(0.3) --cooldown time
canTeleport = true
end
end
telePart.Touched:Connect(otherGame)
well the problem is, youre reserving a new server code each time someone touches the exit door. and only teleporting the player who touched it there.
TeleportService:TeleportToPrivateServer(placeID, ReservedServerAccessCode, {player})
-- see the problem?, you're only passing the player who touched it.
its really supposed to be something like:
local ListOfPlayersInParty = {} --all ur players in the party
TeleportService:TeleportToPrivateServer(placeID, ReservedServerAccessCode, ListOfPlayersInParty)
--see the difference? i passed the table of party members instead of just one player.
now when we combine the fact that you want everyone in the party to teleport when one person exits, this gets really simple.
(I don’t know how your party system ingame works so ill just give you the concept)
simply get the party of the player who touched the exit
instead of teleporting just the player who touched it, teleport that players party
this can be done by putting the other party members in the table.
so like I said before, literally just:
local ListOfPlayersInParty = --youd replace this with a table of all your party memebers.
TeleportService:TeleportToPrivateServer(placeID, ReservedServerAccessCode, ListOfPlayersInParty)
--see the difference? i passed the table of party members instead of just one player.