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

How to teleport a player randomly between two games?

I want a script to teleport a player to game #1 or game #2 but I was never really good with randomizers. Here is script it's a little bit messy:

local TeleportService = game:GetService("TeleportService")
local gameID = 1766746368
local player = game.Players.LocalPlayer
local gameId = 1766751281

math.random(10,20)
wait(math.random)

local random = math.random(0,1)
if random > 1 then
        TeleportService:Teleport(gameID, player)
    end
 
if not random <= 1 then
	TeleportService:Teleport(gameId, player)
end

1 answer

✓ Accepted answer
local TeleportService = game:GetService("TeleportService")
local gameID = 1766746368
local player = game.Players.LocalPlayer
local gameId = 1766751281

wait(math.random(10, 20)) -- Randomly chooses an integer between 10 and 20

local random = math.random(2) -- Randomly chooses either 1 or 2

if random == 1 then
	TeleportService:Teleport(gameID, player)
elseif random == 2 then
	TeleportService:Teleport(gameId, player)
end

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