I started with a script I found on the roblox website on the page for TeleportService:TeleportToPrivateServer, and changed it to my ids. Sorry if this is a basic, mistake, I am new to scripting. The code should teleport the player to a separate game, but it does nothing.
local TS = game:GetService("TeleportService") local Players = game:GetService("Players") local code = TS:ReserveServer(4456038439) -- Returns a code local players = Players:GetPlayers() -- Get a list of all players TS:TeleportToPrivateServer(4456038439,code,players) -- Actually teleport the players
local TeleportService = game:GetService("TeleportService") local gameID = 00000000 -- put the second game's game ID here. function onTouched(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then TeleportService:Teleport(gameID, player) end end script.Parent.Touched:connect(onTouched) -- This is just a simple teleport that teleports you to another game seprate on roblox, No API's or other vip stuff. -- IMPORTANT: You cannot teleport to other games within studio.
This should work
use this if your teleporting every player. the answer above only works when touching a part.
local TeleportService = game:GetService("TeleportService") local Players = game:GetService("Players") local gameID = 0 -- gameid here local code = TeleportService:ReserveServer(gameID) for _,players in pairs(Players:GetPlayers()) do if players:IsA("Player") then TeleportService:Teleport(gameID,code,players) end end