Can't teleport between experiences (HELP)

I’m trying to make it that when a player touches a part they teleport to a different game altogether but whenever I try doing this it always says teleport failed. Here is my code:

local TeleportService = game:GetService("TeleportService")
local gameID = 9424926656
 
function onTouched(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if player then
        TeleportService:Teleport(gameID, player)
    end
end
 
script.Parent.Touched:connect(onTouched)

Are you testing this in Studio?

You can’t teleport in Roblox studio

I did it in game but it still doesn’t allow me

I tested it, works fine for me:
Screenshot (114)
In game, it works too

Did you test it in studio or in game?

If its a different game/experience, you have to enable 3rd party teleports in the game settings

2 Likes

Tested and now it works thank you :slightly_smiling_face:

1 Like

As a quick note, you should probably use Roblox’s SafeTeleport module. It makes teleports retry if they are failed, for a certain amount of times. (in addition to some other things, this is the main one I noticed)

Couldnt you just do this?

function Teleport(Place)
   local Success = pcall(function()
      TeleportService:Teleport(Place, Player)
   end)
if Success then
return
else
task.wait(.5)
Teleport(Place)
end
end

Teleport("Your Id")

You might want to apply some additional code so your code doesn’t try to teleport the player, even if it keeps failing, as this could be a bug with Roblox’s servers or the client’s internet. We don’t want to keep retrying if the teleport fails over and over without success.

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