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

How To Change Maps On CTF Roblox Template? UPDATED

I used the Roblox CTF Template and i made multiple Maps on it, I dont know how to alternate the map, Basicly There is an Intermission that Runs, And after the intermission the game starts, I need to know how to alternate the Game Map After the Game time and before the Intermission!

local GameManager = require(script.GameManager)

GameManager:Initialize()

while true do
	repeat
		GameManager:RunIntermission()
	until GameManager:GameReady()
	
	GameManager:StopIntermission()
	GameManager:StartRound()	
	
	repeat
		GameManager:Update()
		wait()
	until GameManager:RoundOver()
	
	GameManager:RoundCleanup()

end

This Basicly is the Main Game Code, Which runs and Repets itself, I need help on the Map changing code, and where to put it!

1 answer

So what I have here is a "MainScript" (I call my scripts that controls the whole game MainScripts") and it basically has the following (In chronological order):

  1. Intermission
  2. Load a map
  3. Teleport Players
  4. Time finishes and teleport players back
  5. Repeat

(By the way, I think you guys will disagree with this. This is how I found out how to make "event" games.)


-- MAIN VARIBLES --
local musicstorage = game.Workspace.Music --If you want music ingame
local intermissionsong = musicstorage.IntermissionMusic --If you want music in intermission
local h = game.Workspace.Hint -- Status of game (Intermission, InGame)
local mapstorage = game.ServerStorage.Maps

-- STARTING GAME --

-- MAP 1: GRASSLANDS --
while true do
	h.Text = "Starting a new round in 30 seconds."
	wait(30)
	intermissionsong.Music1:Stop()
	h.Text = "Loading a new map! MapNameHere."
	wait(1)
	mapstorage.MapNameHere:clone().Parent = game.Workspace
	wait(5)
	h.Text = "Finished Loading MapNameHere. Map Created by BARBARIAN59."
	wait(5)
	h.Text = "Teleporting Players..."
	wait(1)
	target = CFrame.new(0,0,0) -- When they teleport to the map, this is the position where they tele
for i, player in ipairs(game.Players:GetChildren()) do
	if player.Character and player.Character:FindFirstChild("Torso") then
      player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
end  
end
 
	wait(2)
	h.Text = "3..."
	wait(1)
	h.Text = "2.."
	wait(1)
	h.Text = "1."
	wait(1)
	h.Text = "BATTLE!"
	musicstorage.GameMusic.Music1:Play()
	wait(300) --300 seconds = 5 minutes
	h.Text = "Time is up!"
	musicstorage.GameMusic.Music1:Stop()
	wait(1)
	h.Text = "Teleporting all players back to the lobby."
	wait(0.5)
	intermissionsong.Music1:Play()
	target = CFrame.new(0,0,0) --"ToLobbyBrick"
for i, player in ipairs(game.Players:GetChildren()) do
   if player.Character and player.Character:FindFirstChild("Torso") then
      player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
end
end
wait(2)
game.Workspace.MapNameHere:remove()
wait(1)

once you finish that, just copy and paste this, and i think you know what parts to edit!

(BTW this is my first time here :P)

--BARBARIAN59

1 comment

0

Thx Helped alot!

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