How do i make a custom server system

alright i been asking this question repeatedly for some while now and i think i made some progress on it, so heres the create script in local

local detailedBox = script.Parent.DetailBox
local servername = script.Parent.ServerNameBox
local createButton = script.Parent.CreateButton

detailedBox.FocusLost:Connect(function(enter)
	if enter then
		if detailedBox.Text ~= "" then
			print(detailedBox.Text)
		end
	end
end)

servername.FocusLost:Connect(function(enter)
	if enter then
		if servername.Text ~= "" then
			print(servername.Text)
		end
	end
end)

createButton.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.RemoteEvents.FireCreateServer:FireServer(servername.Text,detailedBox.Text)
end)

heres the serverscript that controls everything

local DataStorage = game:GetService("DataStoreService")
local ServerCodeStorage = DataStorage:GetDataStore("ServerData")
local tp = game:GetService("TeleportService")
local rep = game.ReplicatedStorage

rep.RemoteEvents.FireCreateServer.OnServerEvent:Connect(function(plr, ServerName, detailName)
	local code = tp:ReserveServer(76645132977147)
	local tpOp = Instance.new("TeleportOptions")
	local success, err = pcall(function()
		ServerCodeStorage:SetAsync(ServerName, code, tpOp)
	end)
	if success then
		print("Created Server")
		local value = Instance.new("StringValue",game.ReplicatedStorage.SeverFolder)
		value.Name = ServerName
		value.Value = code..""..tpOp
		tp:TeleportAsync(code, {plr}, tpOp)
	else
		print("Error Creating Server")
	end
end)

rep.RemoteEvents.JoinServer.OnServerEvent:Connect(function(plr, Code)
	local code = string.sub(Code, 1, 6)
	local tpOp = Instance.new("TeleportOptions")
	tp:TeleportAsync(code, {plr}, tpOp)
end)

just the final question is how do i create a join button that appears and how do i check the amount of players in the vip server, i dont understand messingserverservice :frowning:

what im trying to make is a custom type server creation, its basicly, create server, and you get teleported to that server, and the other players who want to join you, doesnt have to be friends, can join you by joinning

if theres any problem with my scripts please say so

On the server, a RemoteFunction that gathers all your reserved server access codes and current player counts using TeleportService:ReserveServer to create, then TeleportService:GetPlayerPlaceInstances or
TeleportService:GetPlayersAsync(code) to count and returns them to the client and on the client, invoke that function, loop through the returned list, clone a TextButton for each entry,
set its label to the server name and “X players” and connect its MouseButton1Click

local TeleportService = game:GetService("TeleportService")
TeleportService:TeleportToPrivateServer(game.PlaceId, accessCode, {Players.LocalPlayer})