So, I would like to teleport to the 2 places in my experience. I had used the code that I used to teleport between games before. It should have worked fine, but I had some issues. The teleport did not work. I would add a debounce since the output says that it failed do the teleport since one is already pending, but I didn’t see this as a huge issue right now.
Here is what my code is so far:
script.Parent.Touched:Connect(function(touch) --when you touch the part, do this
local posplr = game.Players:GetPlayerFromCharacter(touch.Parent) --gets the player that touches the part
if posplr ~= nil then --checks to make sure the player is real
print("Player touched.") -- notifies that the player has touched the part
game:GetService("TeleportService"):Teleport(7086850854, posplr) --teleports the player to the game
end
end)
Now it is hard to check the output, since this game is clustered quite a bit with errors, but I did look through most of the output, and above, was the only errors I saw.
They want to be able to teleport between places in one experience, or one game, enabling that will allow the creator to teleport the player to another experience
Are you trying to teleport in studio? If you are trying to teleport in studio it won’t work and you will have to publish the game and play it in roblox to see if it works. If you are teleporting in game and it isn’t working try adding a pcall function so you can see what the error is, also maybe change Teleport to TeleportAsync.
Weird, I don’t know what would be causing it to be like that, is it a local script or a server script, I’m assuming it is a server script but I don’t know what else would cause it to not work, maybe add another print to see if it even detects the player, or at least can find the player
Edit: I don’t know if you used pcall but this is what it would look like, I don’t know if it works because I haven’t tested it out but it should tell you what is wrong
script.Parent.Touched:Connect(function(touch) --when you touch the part, do this
local posplr = game.Players:GetPlayerFromCharacter(touch.Parent) --gets the player that touches the part
local success, error = pcall(function()
if posplr ~= nil then --checks to make sure the player is real
print("Player touched.") -- notifies that the player has touched the part
game:GetService("TeleportService"):TeleportAsync(7086850854, posplr) --teleports the player to the game
end
end)
if success then
print("Teleporting")
else
print(error)
end
end)
I dont know if this has been solved long time ago but make sure the game your teleporting to is under the original game Unless the “Allow Third Party Teleports” Is Checked
I have third party teleports on but I am trying to teleport to a place within the head game. The weird thing is, if I change the place ID to Doors, the teleport works fine but it won’t work on my own place. I am not sure why this is.