Help with Private Servers from GUI

What I’m trying to do is send the LocalPlayer to a Private Server through clicking a PlayerGUI button. I have a LocalScript inside the button.

local ts = game:GetService("TeleportService")
local event = game.ReplicatedStorage.PrivateServer
local place = 16318595535

script.Parent.Activated:Connect(function()
	event:FireServer(place)
end)

As you can see, I have an event in ReplicatedStorage.
I also have a script inside of ServerScriptService that listens for ServerEvents from the event in Replicated Storage.

local ts = game:GetService("TeleportService")
local event = game.ReplicatedStorage.PrivateServer

event.OnServerEvent:Connect(function(plr, place)
	local code = ts:ReserveServer(place)
	ts:TeleportToPrivateServer(place, code, plr)
end)

It’s not working though. I’ve tried to use just a localscript to teleport the player, but you cannot reserve servers from the client.
Thanks for any help.

The third argument in TeleportToPrivateServer should be an array of players, not just a single player.

	ts:TeleportToPrivateServer(place, code, { plr })

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