Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to teleport a player randomly between two games?

Asked by 6 years ago

I want to make a script where it will teleport you randomly between two games after 10 seconds, but my previous script will not even teleport the player. Please help.

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

wait(10)

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

Answer this question