So I have tried with the "reserveServer" function, but it just pops out in the output "HTTP403 "ReserveServer()" Forbidden" or something like that. I've also tried with TeleportPartyAsync() but it doesn't work either. First I thought it could just work in the public game, and not in the studio. I published and tested it on a public server, but it didn't work too. Can you help me, please? Or is there another way to do this? Also, it will be likely to use reserve server, because after teleporting them, nobody else can join them and that's what I want to do.
Make sure the PLACE you are going to teleport into is in the same GAME
If you don't know what that mean A GAME can have multiple PLACES, a starter place where the players spawn and branch places where they can teleport to
if you want to teleport from a GAME to a different GAME, then you need to put id of the STARTER PLACE from the GAME you wan't to teleport to
In order to let a group of players to go to the same place, get the children of Players
- GetChildren()
or you could make a table with their User ID's , then you can simultaneously teleport them all to the same place in the same game.
function teleport() -- teleport players end local players = {} -- have their ID's for i, v in pairs[players] do teleport() wait(1) -- teleport them with 1 second intervals end
Hope it helps!
AltNature [Lua / Blenderer]#2828
OR this might work too!
You can use RemoteEvents to have the client tell the server teleport all the players.
Server
local placeId = 123 local leaderUserId = 1 local partyPlayersList = { game:GetService('Players').Player1, game:GetService('Players').Player2 } game:GetService('ReplicatedStorage').TeleportSquad.OnServerEvent:Connect(function(player) -- Connects a function to execute when the "TeleportSquad" event is fired if player.UserId == leaderUserId then -- Checks if the player who clicked the start button is equal to the party leader game:GetService('TeleportService'):TeleportPartyAsync(placeId, partyPlayersList) -- Teleports all players in "partyPlayersList" end end)
Client
StartButton.MouseButton1Click:Connect(function() -- Connects a function to execute when the client clicks the button game:GetService('ReplicatedStorage').TeleportSquad:FireServer() -- Fires the remote event end)
for i,v in pairs(game.Players:GetPlayers()) do -- gets every player in the server game:GetService("TeleportService"):Teleport(game.PlaceId, player) -- teleports them to the same game if player.Character ~= nil then player.Character:remove() end end