How to make a player it's own empty alone server when entered the game

The game world mechanics I’m creating is that a player will usually be inside it’s own empty server when entered the game, until they switch worlds (joining to other player servers).

Just like the Roblox game: Islands, when you enter the game, you are in your own server until you join to other people’s server teleporting you in there.

How would I accomplish this?

1 Like

Teleport the player to a Reserved Server using TeleportService methods:

if game:GetService("RunService"):IsStudio() then return end
if game.PrivateServerId ~= "" then return end -- ignore if this server is already private
local LoadingScreen = nil -- most likely want a loading screen here
local ts = game:GetService("TeleportService")

game.Players.PlayerAdded:Connect(function(player)
	local accesscode = ts:ReserveServer(game.PlaceId)
	ts:TeleportToPrivateServer(game.PlaceId, accesscode, {player}, nil, nil, LoadingScreen)
end)

Hi, Thanks for the reply, this really helped me!

I got a quick question about the teleport service:

Is it possible for a player to teleport in custom made-up place id?
I am needing this so that if a player enters a server with a random id they typed, they’ll get teleported there.

This isn’t possible, but you can replicate this exact behavior by just using Datastores to save the access code, using this made-up id. I’m pretty sure access codes last forever and are never repeated.

Alright I got it, thanks for the solution!

I also apologize for the kind of confusion question about the ‘custom made-up placeid’. I just thought that place id means server id, but it’s actually the id of the game^^

The ‘JobId’ is actually the server id. This is similar to a reserved server access code, because they are never repeated and never expire.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.