Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

teleport to another game not working ?

so I'm making a game with 2 places so I'm attempting to make a teleport that allows you to go between the too buy touching the part here's the script the game is published and the game id is correct any solutions? I tried other scripts but nothing worked.

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

6 comments

1

Ensure you're using a Server-sided Script; workspace is a global environment, localized programs will not function there.

0

i dont understand lol

0

Use a regular Script, not a LocalScript.

0

i did

0

You can't teleport in the Studio either.

0

Also dont use connect but use Connect instead, connect is deprecated

1 answer

Well, you have the right script :) Make sure that is a script in ServerScriptService Also click File in the top left corner of the Studio then click Publish To Roblox Also turn on API Services In the Settings On the Studio, then try it out on the game NOT the Studio. Hope this helps!

4 comments

0

hi thanks :) do i put the part in serverscript service too?

0

it didnt work :(

0

API Service access isn't required for this.

0

Ok don’t turn on API services then try

This discussion is preserved as it was. New answers, comments, and votes are closed.