Can't teleport to reserved server

when i try to teleport it says it’s a restricted place but i do provide the access code with i thought would mean it would let me in. i guess i’m not sure how access codes work so any help would be much appreciated :v:thank you

local event = game.ReplicatedStorage.Teleport.room
local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")

event.OnServerEvent:Connect(function(player,CODE) -- code is sent from the client and is the reserved server's access code
	TS:TeleportToPrivateServer(9999999999,CODE,{player}) -- not the real place id but that's where the place id would go
end)

that looks like it should work
have you tried ingame? I think teleporting doesnt work in studio tests

1 Like

yes iv’e tried in-game … chars

is the place you’re teleporting to in the same game? if not, is it the starting place of the game it’s in?
you can’t teleport to a non-starting place of another game

1 Like

yes the place is in the same game, it is a reserved server

does this give you any errors? and how does the clientside code that does :FireServer look? maybe you put the wrong number of arguments?

this is the script that fires the server

local event = game.ReplicatedStorage.Teleport.room

script.Parent.button.MouseButton1Click:Connect(function()
	event:FireServer(script.Parent.code.Value) -- there is a int value with the code
end)

there is just the error saying the access code isn’t authorized

Where do they get an access code?

We need to see that since it’s obviously an error with the code.

1 Like
local code = TS:ReserveServer(999999999) -- 999.. isn't the real place id but this line of code makes a reserved server for the place id there
	
	for i,v in ipairs(game.Players:GetChildren()) do -- when someone teleports to their reserved server it will also add it to a list in a gui for everyone still in the lobby so others can join, that other script was for joining a reserved server from this list
		local gui = v.PlayerGui.popUps.map.rooms.otherRoom.ScrollingFrame.room:Clone() -- makes a gui that will be used as a button to teleport
		gui.Visible = true
		gui.Parent = v.PlayerGui.popUps.map.rooms.otherRoom.ScrollingFrame
		gui.displayName.Text = player.DisplayName
		gui.userName.Text = ("@")..player.Name
		gui.code.Value = code
	end

Simple problem.

The Code isn’t an Integer. You can’t use an IntValue for it. It’s a string, and quite a long one too.

image

2 Likes