Making an Apeirophobia Lobby System (Need help on this please)

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Hello! I’m DragonDarkVader, A Roblox Developer with almost 1.6 years of Building experience and currently learning coding too! I’m having trouble with CreatePrivateServer() and using ReservedServer() and TeleportToPrivateServer(). The game is currently inspired by Apeirophobia. I’m making a Lobby Gui which is like Apeirophobia!

  1. What is the issue? *I’m currently having trouble on this. Well i have the script tho. Just the Create Button, Password Button (Where you can generate your password) and choices if your server is public or private! And if the Player creates a Server. It displays in the “Servers” Frame. And with the Players profile and Name in it with the Join Button. And with the text which updates everytime a player joins which is the “Queue: 0/4”

  2. What solutions have you tried so far? I tried looking up in DevForum. And created a topic like this, Nobody responded to EVERY topic i created. I found a Documentation in Developer Forum (Not DevForum) and it shows everything. Just the Button which you can create a server with choices if your server is public/private and you can generate a code to it.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

THE CODE:

-- // ReserveServer() \\ --

local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")

local code = TeleportService:ReserveServer(game.PlaceId)

local players = Players:GetPlayers()

TeleportService:TeleportToPrivateServer(game.PlaceId, code, players)

local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")

local dataStore = DataStoreService:GetGlobalDataStore()

local code = dataStore:GetAsync("ReservedServer")
if typeof(code) ~= "string" then
	code = TeleportService:ReserveServer(game.PlaceId)
	dataStore:SetAsync("ReservedServer", code)
end

local function joined(player)
	player.Chatted:Connect(function(message)
		if message == "reserved" then
			TeleportService:TeleportToPrivateServer(game.PlaceId, code, { player })
		end
	end)
end

Players.PlayerAdded:Connect(joined)

-- // GetArrivingTeleportGui() \\ --

local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local ReplicatedFirst = game:GetService("ReplicatedFirst")

local customLoadingScreen = TeleportService:GetArrivingTeleportGui()
if customLoadingScreen then
	local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
	ReplicatedFirst:RemoveDefaultLoadingScreen()
	customLoadingScreen.Parent = playerGui
	task.wait(5)
	customLoadingScreen:Destroy()
end

-- \\ GetTeleportSetting() \\ --

local TeleportService = game:GetService("TeleportService")

local teleportData = TeleportService:GetLocalPlayerTeleportData()

print("Local player arrived with this data:", teleportData)

-- // SetTeleportGui() \\ --

local TeleportService = game:GetService("TeleportService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local TeleportScreen = ReplicatedStorage.TeleportingScreen

TeleportService:SetTeleportGui(TeleportScreen)

-- // TeleportPartyAsync() \\ --

local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")

local PLACE_ID = 11278087451 -- replace
local playerList = Players:GetPlayers()

local success, result = pcall(function()
	return TeleportService:TeleportPartyAsync(PLACE_ID, playerList)
end)

if success then
	local jobId = result
	print("Players teleported to", jobId)
else
	warn(result)
end

-- // Teleport() \\ --

local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")

local PLACE_ID = 11278087451 -- replace here
local USER_ID = 1 -- replace with player's UserId

local player = Players:GetPlayerByUserId(USER_ID)

TeleportService:Teleport(PLACE_ID, player)

local TeleportService = game:GetService("TeleportService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")

local PLACE_ID = 0 -- replace here
local loadingGui = ReplicatedStorage:FindFirstChild("LoadingGui")

-- parent the loading gui for this place
loadingGui.Parent = playerGui

-- set the loading gui for the destination place
TeleportService:SetTeleportGui(loadingGui)

TeleportService:Teleport(PLACE_ID)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Can anybody help me? Or provide tutorials that find helpful to me?

1 Like

Hi! I can help =)

I’ve been making a lobby similar.

Here’s a good example of a lobby script:

local tps = game:GetService("TeleportService")
local placeId = 123456789 -- Place id here (Replace 123456789 to your Main Game Id)


game.ReplicatedStorage.PartySystemRE.OnServerEvent:Connect(function(player, instruction, value1, value2)
	
	
	if instruction == "kickPlayer" then
		
		if game.ReplicatedStorage.Parties:FindFirstChild(value1) and value2.Parent == game.ReplicatedStorage.Parties[value1].Players then
			if game.ReplicatedStorage.Parties[value1].Players["Party Leader"].Value == player.Name or value2.Value == player.Name then
				
				if game.ReplicatedStorage.Parties[value1].Players["Party Leader"].Value == value2.Value then
					
					for i, playerInParty in pairs(game.ReplicatedStorage.Parties[value1].Players:GetChildren()) do
						
						game.ReplicatedStorage.PartySystemRE:FireClient(game.Players[playerInParty.Value], false, value1)
					end
					
					game.ReplicatedStorage.Parties[value1]:Destroy()
					
				else
					
					game.ReplicatedStorage.PartySystemRE:FireClient(game.Players[value2.Value], false, value1)
					
					value2:Destroy()
				end
			end
		end
		
		
	elseif instruction == "createParty" then
		
		local partyName = value1 or player.Name .. "'s Party"		
		partyName = game:GetService("TextService"):FilterStringAsync(partyName, player.UserId)
		partyName = partyName:GetNonChatStringForBroadcastAsync()
		
		local newParty = Instance.new("Folder")
		newParty.Name = partyName
		
		local players = Instance.new("Folder", newParty)
		players.Name = "Players"
		
		local partyLeader = Instance.new("StringValue", players)
		partyLeader.Name = "Party Leader"
		partyLeader.Value = player.Name
		
		local limit = Instance.new("IntValue", newParty)
		limit.Name = "PlayerLimit"
		limit.Value = tonumber(value2) or 10
		
		newParty.Parent = game.ReplicatedStorage.Parties
		
		game.ReplicatedStorage.PartySystemRE:FireClient(player, true, partyName)
		
		
	elseif instruction == "joinParty" then
		
		if game.ReplicatedStorage.Parties:FindFirstChild(value1) and #game.ReplicatedStorage.Parties[value1].Players:GetChildren() < game.ReplicatedStorage.Parties[value1].PlayerLimit.Value then
			
			local playerValue = Instance.new("StringValue")
			playerValue.Value = player.Name
			playerValue.Parent = game.ReplicatedStorage.Parties[value1].Players
			
			game.ReplicatedStorage.PartySystemRE:FireClient(player, true, value1)
		end
		
		
	elseif instruction == "startParty" then
		
		if game.ReplicatedStorage.Parties:FindFirstChild(value1) and game.ReplicatedStorage.Parties[value1].Players["Party Leader"].Value == player.Name then
			
			local playersToTP = {}
			
			for i, playerInParty in pairs(game.ReplicatedStorage.Parties[value1].Players:GetChildren()) do
				
				table.insert(playersToTP, game.Players[playerInParty.Value])
			end
			
			
			local tpOptions = Instance.new("TeleportOptions")
			tpOptions.ShouldReserveServer = true
			
			tps:TeleportToPrivateServer(placeId, playersToTP, tpOptions)
		end
	end
end)


game.Players.PlayerRemoving:Connect(function(player)
	
	for i, d in pairs(game.ReplicatedStorage.Parties:GetDescendants()) do
		
		if d:IsA("StringValue") and d.Value == player.Name then
			
			if d.Name == "Party Leader" then

				for i, playerInParty in pairs(d.Parent:GetChildren()) do

					game.ReplicatedStorage.PartySystemRE:FireClient(game.Players[playerInParty.Value], false, d.Parent.Parent.Name)
				end
				
				d.Parent.Parent:Destroy()

			else

				game.ReplicatedStorage.PartySystemRE:FireClient(player, false, d.Parent.Parent.Name)

				d.Parent.Parent:Destroy()
			end
		end
	end
end)
3 Likes

This script will teleport the selected players into a reserved / private server :slight_smile:

1 Like

– // TeleportToPlaceInstance() \ –

local Players = game:GetService(“Players”)
local TeleportService = game:GetService(“TeleportService”)

local PLACE_ID = 11278087451 – replace here
local INSTANCE_ID = 0 – replace here
local USER_ID = 1 – replace with player’s UserId

local player = Players:GetPlayerByUserId(USER_ID)

TeleportService:TeleportToPlaceInstance(PLACE_ID, INSTANCE_ID, player)

– // TeleportToPrivateServer() \ –

local Players = game:GetService(“Players”)
local TeleportService = game:GetService(“TeleportService”)

local PLACE_ID = 11278087451 – replace here
local SERVER_CODE = “a-b-c-d-e” – replace here
local USER_ID = 1 – replace with player’s UserId

local player = Players:GetPlayerByUserId(USER_ID)

TeleportService:TeleportToPrivateServer(PLACE_ID, SERVER_CODE, player)

– // TeleportToSpawnByName() \ –

local Players = game:GetService(“Players”)
local TeleportService = game:GetService(“TeleportService”)

local PLACE_ID = 11278087451 – replace here
local SPAWN_NAME = “Spawn” – replace here
local USER_ID = 1 – replace with player’s UserId

local player = Players:GetPlayerByUserId(USER_ID)

TeleportService:TeleportToSpawnByName(PLACE_ID, SPAWN_NAME, player)

– // GetTeleportResult() \ –

local TeleportService = game:GetService(“TeleportService”)
local Players = game:GetService(“Players”)

local USER_ID = 1 – replace here
local player = Players:GetPlayerByUserId(USER_ID)

local result = TeleportService:GetTeleportResult(player)

– // TeleportToPrivateServer() \ –

local Players = game:GetService(“Players”)
local TeleportService = game:GetService(“TeleportService”)

local PLACE_ID = 11278087451 – replace here
local SERVER_CODE = “a-b-c-d-e” – replace here
local USER_ID = 1 – replace with player’s UserId

local player = Players:GetPlayerByUserId(USER_ID)

TeleportService:TeleportToPrivateServer(PLACE_ID, SERVER_CODE, player)

– // GetTeleportingToPrivateServer() \ –

local TeleportService = game:GetService(“TeleportService”)
local Players = game:GetService(“Players”)

local USER_ID = 1 – replace here
local player = Players:GetPlayerByUserId(USER_ID)

local result = TeleportService:GetTeleportingToPrivateServer(player)

– // GetTeleportData() \ –

local TeleportService = game:GetService(“TeleportService”)
local Players = game:GetService(“Players”)

local USER_ID = 1 – replace here
local player = Players:GetPlayerByUserId(USER_ID)

local result = TeleportService:GetTeleportData(player)

– // GetLocalPlayerTeleportData() \ –

local TeleportService = game:GetService(“TeleportService”)
local Players = game:GetService(“Players”)

local result = TeleportService:GetLocalPlayerTeleportData()

– // GetPlayerPlaceInstanceAsync() \ –

local Players = game:GetService(“Players”)
local TeleportService = game:GetService(“TeleportService”)

local USER_ID = 1 – replace here
local player = Players:GetPlayerByUserId(USER_ID)

local placeId, instanceId = TeleportService:GetPlayerPlaceInstanceAsync(player)

– // GetPlaceInstanceAsync() \ –

local TeleportService = game:GetService(“TeleportService”)

local placeId = 11278087451 – replace here
local placeName = “Apeirophobia” – replace here

local placeId, instanceId = TeleportService:GetPlaceInstanceAsync(placeId, placeName)

– // GenerateTeleportGuiFromExisting() \ –

local TeleportService = game:GetService(“TeleportService”)
local Replicated

3 Likes

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