[FIXED] Problems with teleporting

So i have this story game and I just can’t get this teleportation system to work

image

Here is my code script.Parent.Touched:Connect(function(Touched)
if Touched.Parent:FindFirstChild(“Humanoid”) then
local Character = Touched.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
table.insert(PlayerTable,Player)
else
return
end
if #PlayerTable >= 1 then
print(“Almost yay”)
local Server = TeleportService:ReserveServer(4701493313)
TeleportService:TeleportToPrivateServer(4701493313,Server,Players)
end
end)

Would be greatful if I could get this to work

Is this the code from “Gate” The reason why im asking is because there’s a problem on line 38 of the code
but the one u gave us doesn’t seem to go past line 13.

Yeah its from a gate you go in

Are you running this script on the client or on the server? (Script or LocalScript)
Also, I’m pretty sure you should wrap this in a pcall function to prevent the script halting when errors occur, like this.

But it happens everytime and yeah it’s for sure in a script

how many gates do u have. In the problem it says GATE_A
and to me that means there might be other gates in the game as well.

Okay.
Could you:

  • Point out the line that the error is on
  • Make sure the game you’re teleporting to is public

Yes there is gate a gate c gate b but im only scripting gate a right now

Might checking out this post? It’s actually the same problem. Take a look at what colbert answered.

The error is this line
local Code = TeleportService:ReserveServer(4701493313)
also i made a pcall now
local Players = game:GetService"Players"
local PlayerTable = {}
local TeleportService = game:GetService(“TeleportService”)
local Id = 4701493313
–//TeleportHandler
script.Parent.Touched:Connect(function(Touched)
if Touched.Parent:FindFirstChild(“Humanoid”) then
local Character = Touched.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
table.insert(PlayerTable,Player)
else
return
end
if #PlayerTable >= 1 the
print(“Almost yay”)
local Succes, Error = pcall(function()
local Code = TeleportService:ReserveServer(4701493313)
end)
if Succes then
print(“Succes”)
local Playerss = Players:GetPlayers()
local Code = TeleportService:ReserveServer(4701493313)
TeleportService:TeleportToPrivateServer(4701493313,Code,Playerss)
else
print(Error)
end
end
end)

What game are you running this script from?
Make sure that it is eligible for teleporting to your target place:
image

1 Like

I just tried to teleport to a story game thats doing well still getting the [HTTP 403 (Forbidden)

Are you testing this in studio or in the actual game? Teleportation is restricted in studio testing.

Yes i know but it should say “Can’t teleport in studio”

1 Like

Please check out this post. Colbert explained why this error comes up!

2 Likes

It’s teleporting but i need to type game.Players:FindFirstChild(“Andueey”) and then it would teleport but I can’t get the teleport thing to teleport everyone in the table

–//Variables

local PlayerTable = {}

local TeleportService = game:GetService(“TeleportService”)

local Id = 3387051590

–//TeleportHandler

script.Parent.Touched:Connect(function(Touched)

if Touched.Parent:FindFirstChild(“Humanoid”) then

local Character = Touched.Parent

local Player = game.Players:GetPlayerFromCharacter(Character)

table.insert(PlayerTable,Player)

else

return

end

if #PlayerTable >= 1 then

TeleportService:Teleport(Id,PlayerTable)

end

end)
It’s giving a warning Invalid player to teleport

I thought you wanted to use :ReserveServer() so I had made this script, however looking at the last script you posted I’m not sure if this is what you want to do.

wait()

local Players = game:GetService("Players")
local PlayerTable = {}
local TeleportService = game:GetService("TeleportService")

script.Parent.Touched:Connect(function(Touched)
	if Touched.Parent:FindFirstChild("Humanoid") then
		local Character = Touched.Parent
		local Player = game.Players:GetPlayerFromCharacter(Character)
		table.insert(PlayerTable, Player)
		if #PlayerTable >= 1 then
			local Succes, Error = pcall(function()
				local Code = TeleportService:ReserveServer(game.PlaceId)
			end)
			if Succes then
				local Code = TeleportService:ReserveServer(game.PlaceId)
				TeleportService:TeleportToPrivateServer(game.PlaceId, Code, PlayerTable)
			else
				print(Error)
			end
		end
	end
end)

I tested this script and it worked fine for me.

1 Like

Made my own and i got that working, but thanks for your support

You can’t be teleported in Roblox Studio, you must test it published in roblox.

1 Like

Yeah, i know :smiley: But, its fixed now