So I’m making a game like roblox uno and I want to know how do I make a reserved private server and then send players to that server
Here’s what I got so far!
Server Creation Code
local RS = game:GetService("ReplicatedStorage")
local TS = game:GetService("TeleportService")
local placeId = 9222349596 --Change this to your place id
local code = TS:ReserveServer(9222349596)
game.ReplicatedStorage.ServerCreation.OnServerEvent:Connect(function(Player, playersMoving)
TS:TeleportToPrivateServer(placeId, code, {Player})
end)
So players will be able to type a server code into a TextBox and then press a button and enter the server
Server join code:
Server Join Code
local ts = game:GetService("TeleportService")
game:GetService("ReplicatedStorage").ServerJoining.OnServerEvent:Connect(function(Player)
local serverCode = Player.PlayerGui.menu.Joining.TextBox.Text
ts:TeleportToPrivateServer(9222349596, serverCode, {Player})
end)
However it will not let others join and prompts me with this message
Please help I’ve tried looking around the internet for an answer
Thank you in advance developers of roblox!
You can’t reference the text of a player’s textbox from the server, so you must add it when firing the remote event. This should work for you, just make sure to pass the serverCode in the localscript while firing the remote
local ts = game:GetService("TeleportService")
game:GetService("ReplicatedStorage").ServerJoining.OnServerEvent:Connect(function(Player, serverCode)
ts:TeleportToPrivateServer(game.PlaceId, serverCode, {Player})
end)
Ok so I’ve done what you said and it’s still prompting the 2ND player that try’s to join a Restricted error
I have two questions, as this should be repeatable:
1: Did you try this multiple times?
2: Did you type the code by hand into the textbox, or copy and paste it? Copy and pasting it would be better.
Sorry if I’ve caused confusion but to answer your questions
- Yes, I’ve tried many times
- Copy & Pasted it & Double checked the code!
Here is a rec of what is happening and the system I’m making! Thanks
I’m pretty sure this is just a roblox thing because when I press f9 after teleporting It gives me this error: PlaceLaucher : Teleport failed because join script failed to load. I still get teleported, but when I put the join code into the text box on my alt it gave me the same error that you’re having. I don’t know if there’s a fix.