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

Game portal changing script not working? Roblox

So I'm not sure what I'm doing wrong but the following script gives the following error:

local TeleportService = game:GetService("TeleportService") local gameID = (The 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)

Error: 08:31:42.355 - Workspace.Waterfall Level Portal.To Game Script:2: attempt to perform arithmetic (sub) on nil

I'm trying to simply make a portal from one game to another; thanks ahead for your help.

2 comments

0

Did you put the game ids in?

0

Yes

1 answer

As far as I know, teleportation between games doesn't work in ROBLOX Studio, and has to be tested in the ROBLOX Player. If you were teleporting from your game's starter place to another place in the game, that will work. If you don't know how to add extra places to your game, there is a tutorial here

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