Here’s the code:
local lobbyLocation = game.Workspace.Lobby.Position + Vector3.new(0, 3, 0)
local gameLocation = game.Workspace.Main.Position + Vector3.new(0, 3, 0)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local timeEvent = ReplicatedStorage:WaitForChild("TimeEvent")
-- Get a reference to an existing object
local original = game.ServerStorage.Map
-- Create the model copy
local copy = original:Clone()
copy.Name = 'Map2'
-- Parent the copy to the same parent as the original
copy.Parent = original.Parent
-- Move the copy so it's not overlapping the original
local function playGame()
game.ServerStorage.Map2.parent = game.Workspace
local timeAmount = 10
local timerText = "Time until we leave: "
while timeAmount > 0 do
timeEvent:FireAllClients(timeAmount, timerText)
wait(1)
timeAmount -= 1
end
end
local function playIntermission()
game.Workspace.Map2:Destroy()
local clone = original:Clone()
clone.Name = "Map2"
clone.Parent = game.ServerStorage
local intermission = 20
local timerText = "Time until we travel: "
while intermission > 0 do
timeEvent:FireAllClients(intermission, timerText)
wait(1)
intermission -= 1
end
end
local function resetPlayers()
for _, plr in pairs(game.Players:GetChildren()) do
plr.Character.HumanoidRootPart.CFrame = CFrame.new(lobbyLocation)
end
end
local function teleportPlayers()
for _, plr in pairs(game.Players:GetChildren()) do
plr.Character.HumanoidRootPart.CFrame = CFrame.new(gameLocation)
end
end
while true do
resetPlayers()
playIntermission()
teleportPlayers()
playGame()
end
I pretty much tried to clone the map and put the clone in the workspace but it destroys the whole script and makes the timer not work (the timer worked before)