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.
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