Teleport Pad to other game Not working

I have watched many youtube tutorials, they all work but for some reason, none of them work on my game. If I use a different game, the teleport pads will work but not on the game I use. The script is :

local TeleportService = game:GetService(“TeleportService”)
local gameID = 6105017665 --Remove this and put the second Game ID –

function onTouched(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
	TeleportService:Teleport(gameID, player)
end

end

script.Parent.Touched:Connect(onTouched)

Also, the game it doesnt work on is:
Subway - Roblox
Can you please tell me why it doesnt work.

If it’s a local script, local scripts won’t run in workspace. If it’s a regular script it looks fine to me.

It is regular. I am trying to see why it doesn’t work, I could have some scripts that dont allow it. But I don’t know I am not a scripter, this is really frustrating.

can you try adding prints inside the function just to see if it fires?

Could you tell me how to do that, lol. I am completely in the dark about scripting.

I just looked at output, probably should’ve done that before.

It says this when I step on the pad : exception while signaling: Cannot Teleport in the Roblox Studio. (x2)

Oh thats because I am in studio, I am being stupid.

local TeleportService = game:GetService(“TeleportService”)
local gameID = 6105017665 --Remove this and put the second Game ID –

function onTouched(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        print("1")
        local player =  game.Players:GetPlayerFromCharacter(hit.Parent)
        print("2")
        TeleportService:Teleport(gameID, player)
    end
end

script.Parent.Touched:Connect(onTouched)

try this and tell me if it prints. (i updated the code a little bit)

Alright, also by my last comment, that doesn’t mean I have only been testing in Studio, I have been testing in game.

Nothing is happening in output, I will test it in game.

Nothing happened in game either

Hmm. Can you try this code instead? It’s not for teleporting but im just trying to make sure Touched event is firing.

local debounce = false
local TeleportService = game:GetService("TeleportService")
local placeId = 6105017665

script.Parent.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        if debounce == true then return end
            debounce = true
            print("Someone Touched to this part!")
            TeleportService:Teleport(placeId, player)
            wait(5)
            debounce = false
    end
end)

please tell me if it prints (i will edit this message if it prints)

I updated the code try it. If it won’t teleport maybe it’s an issue with roblox.

It does print the message

filling up the characters

It didn’t work, I think its an issue with my game, not roblox. It works on other games just not the game im trying to use it on. Thank you for trying

did it print though? also i forgot to delete an end so i updated the code again. Also don’t try on roblox studio. If it won’t work again I don’t know. Sorry.

This is what it printed exception while signaling: Cannot Teleport in the Roblox Studio.
it also said Someone touched this part! Didn’t see that when I typed that out.

As i said, don’t try it on roblox studio because you won’t be teleported in roblox studio. Try it in actual game and see if it works.

It doesn’t work in actual game.

1 Like

for one the half visible has can collide off and would be invisible

local part1 = script.Parent
local part2 = script.Parent.Parent
local id -- id here
local function touched(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if player then
		game:GetService('TeleportService'):Teleport(player,id)
	end
end

part1.Touched:Connect(function(hit)
	touched(hit)
end)
part2.Touched:Connect(function(hit)
	touched(hit)
end)

as far as I can tell given the erros that you cannot telport in studio this should work, just place the id in the varible id

ignore the other stuff I use this place for testing random things so there are alot of random things around

though i still dont see anything wrong with any of the other code methods they should all work, just check that the place your teleporting to is actually a place in that games “universe” you can check this though the developer area of the website and see the places of that game

It didnt work, the game im trying this in is a group game by the way. I just realised, does the other game also have to be a group game?