so i tried to learn reserved servers i looked on youtube and there were no tutorials I read the roblox aricle about it https://developer.roblox.com/en-us/api-reference/function/TeleportService/TeleportToPrivateServer
But still i cant seem to get how i would make a reserved server for a group of players
Just so you know before trying, ReserveServer doesn't work in Studio. So make sure to playtest in Roblox Player.
Also, make sure that the place you're reserving a server for is inside the same game as the place which is reserving a server. It might work on places outside the game of the place which is reserving a server, but I am not sure.
I am assuming you're having trouble teleporting several people to a reserved server, not with making a reserved server. If I am wrong please reply to this to let me know.
To teleport several people to a reserved server, there's a thing you can use called tables.
Explaning how it works fully would take too long, so if you want to learn check this out: https://developer.roblox.com/en-us/articles/Table
To add a player to your table, you use the table.insert command.
Here's a quick showcase on how it could work if I was in the server where the script is running:
local players = {} table.insert(players, game.Players.EmK530) print(players[1].Name) -- Output should say EmK530
To teleport players correctly using tables, you have to add the instance of the player. Which I basically did in the example script, but I'm assuming you have a functioning script which can add all the players into the group table.
Now, once we have our fully functional table, we can teleport all players like the script below. (this table I am making here won't work with yours, you know what to do, this is just an example!)
local players = {} table.insert(players, game.Players.EmK530) local TS = game:GetService("TeleportService") local code = TS:ReserveServer(0000000) -- fix the place ID here please TS:TeleportToPrivateServer(0000000, code, players) -- and fix the place ID here too
If anything goes wrong, let me know. Glad I could help!
If you wish to reserve a Server of your game, you can use TeleportService’s :ReserveServer()
method. This takes an argument of which Place to reserve a Server to, that of which we can supply with game.PlaceId
to create a branch for your place. To actively move Players to a reserved Server, you must use :TeleportToPrivateServer()
function, yes. It requires the similar ID of the Place you wish to transport to, the access code provided by :ReserveServer()
and an array of Player Objects to transfer
local TeleportService = game:GetService("TeleportService") local Reserve = TeleportService:ReserveServer(game.PlaceId) local Players = game.Players:GetPlayers() --// Returns an array of all Players TeleportService:TeleportToPrivateServer(game.PlaceId, Reserve, Players)
This must be handled via a ServerScript, and will only be functional outside the Studio.