Teleport to place doesn't work

So I’m making this game where you can teleport to an other world to do some stuff. I made a new place an used this script in a sort of portal:

local Part = script.Parent
Part.Touched:Connect(function(HIT)
local H = HIT.Parent:FindFirstChild(“Humanoid”)
if H then
local playerName = HIT.Parent.Name

	local player = game.Players:FindFirstChild(playerName)	

		if player then
		
		
		game:GetService('TeleportService'):Teleport(my code here)
		
		
		end
	
end

end)

But I get error 773: “Roblox attempted to teleport to a place that is restricted” and I already tried a lot of things, so I was hoping someone could help me here.

Did you enable third party teleports

yes on the added place and in the starter place (this script is an local script btw but with a server script it also doesn’t work

You should use :TeleportAsync() when teleporting users to subplaces, as this function supports more types of teleports.

For :TeleportAsync(), you will have to pass the instance of the Player and the placeID as the parameters of this function. Replace

With:

game:GetService(‘TeleportService’):TeleportAsync(placeID, H)

Also, you are not able to test subplace teleports or 3rd-Party teleports in Studio. Please test them in the Roblox client!

I get an error: ‘Unable to cast value to objects’. What does that mean? I’m still learning a lot so I’m sorry for all the questions.

TeleportAsync() takes a table for the players you want to teleport. You can do this by simply adding {} around the player you are trying to teleport. It should look something like this:

game:GetService(‘TeleportService’):TeleportAsync(placeID, {player})

If you want to teleport multiple players, just add more players into the table like this:

game:GetService(‘TeleportService’):TeleportAsync(placeID, {player1, player2, player3...})

It gives me error 773 again, I’m getting hopeless about this situation, thanks for try helping me tho.

I think this error is caused by network issues because it only occurs sometimes. I’m not sure if this will help, but you can try to restart your router/device.

I don’t think that’s the problem because I use a network cable. But at this point I would try anything I’m trying to fix this about a week already and I’m getting frustrated.

You should try and make sure both places are published and public, that may be why it’s causing an error.

OMG I don’t know how because I did something I already tried a million times but now it finally worked, thank you so much!!

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