Hello, devs! I am trying to make a button that fires a RemoteEvent which reserves a server and teleports the player to it. I would also like for the new place to show the code so other players can join. However, I am really stuck because when I try to reserve the server, it brings HTTP 403 (Forbidden). Thanks for any help!
Local Script:
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.CreateServer:FireServer(player)
print("Fired!")
end)
Server Script:
local TeleportService = game:GetService("TeleportService")
local PlaceId = 7399821818
game.ReplicatedStorage.CreateServer.OnServerEvent:Connect(function(player)
local code = TeleportService:ReserveServer(PlaceId)
wait(5)
TeleportService:TeleportToPrivateServer(PlaceId, code, player)
end)
Wow. It works! Thank you! One question though, how can I send the code over to the new server? Is it already sent with the :TeleportToPrivateServer() function or would I need to add it in as an extra parameter? Thanks!