Third, you need to create a folder in ReplicatedStorage, and name it (Maps) And put all the maps in the folder
create StringValue in ReplicatedStorage and name it (Status)
and create a gui
Settings
name it: StatusGui ResetOnSpawn: false IgnoreGuilnset: true
and create a textlabel
Settings
Text: Intermission: Put it anywhere
Scripting
Create a LocalScript in StatusGui
local Status = game.ReplicatedStorage:WaitForChild("Status")
local TextLabel = script.Parent:WaitForChild("TextLabel")
Status:GetPropertyChangedSignal("Value"):Connect(function()
TextLabel.Text = Status.Value
end)
and name it a script DisplayScript
Create a script in ServerScriptService
local Lobby = game.Workspace.Lobby
local Map = game.ReplicatedStorage.Maps
local Status = game.ReplicatedStorage.Status
While true do
for i = 10, 0, -1 do
Status.Value = "intermission: " ..i
task.wait(1)
end
local ChosenMap = Maps[math.random(1, #Maps)]
local ClonedMap = ChosenMap:Clone()
ClonedMap.Parent = game.Workspace
Status.Value = "Map: " ..ClonedMap.Name
task.wait(3)
for i, Player in pairs(game.Players:GetPlayers()) do
local Character = Player.Character
if Character then
local HumanoidRootPart = Character.HumanoidRootPart
HumanoidRootPart.CFrame = ClonedMap.TeleportPoint.CFrame
end
end
for i = 10, 0, -1 do
Status.Value = "Game: " ..i
task.wait(1)
end
for i, Player in pairs(game.Players:GetPlayers()) do
local Character = Player.Character
if Character then
local HumanoidRootPart = Character.HumanoidRootPart
HumanoidRootPart.CFrame = Lobby.TeleportPoint.CFrame
end
end
ClonedMap:Destroy()
end
NOTE: When you get rid of the lobby and the map, you must put TeleportPoint, not Spawn
Good tutorial, only thing do is that you should also explain what the code does, from a newbie’s view form what he knows you could also be putting a back door in his game, otherwise it’s great!
local Lobby = game.Workspace.Lobby
local Maps = game.ReplicatedStorage.Maps
local Status = game.ReplicatedStorage.Status
while true do
for i = 10, 0, -1 do -- This loop will update the timer for the round intermission
Status.Value = "intermission: " .. i -- Here we set the status value to the current status
task.wait(1)
end
local ChosenMap = Maps[math.random(1, #Maps)] -- After the intermission has ended we get a random map
local ClonedMap = ChosenMap:Clone() -- Here we clone the map
ClonedMap.Parent = game.Workspace -- Here we parent the map to the workspace
Status.Value = "Map: " .. ClonedMap.Name -- Here we set the status value to the name of the cloned map
task.wait(3)
for i, Player in pairs(game.Players:GetPlayers()) do -- Here we loop through all of the players in the game
local Character = Player.Character -- Here we get the character of that player
if Character then -- Here we check and make sure it's not nil
local HumanoidRootPart = Character.HumanoidRootPart -- Here we get the "HumanoidRootPart" of the players character
HumanoidRootPart.CFrame = ClonedMap.TeleportPoint.CFrame -- Here we set the cframe of the "HumanoidRootPart" to the TeleportPoint's cframe
end
end
for i = 10, 0, -1 do -- This loop will update the timer for the round
Status.Value = "Game: " ..i
task.wait(1) -- Here we set the status value to the current status
end
for i, Player in pairs(game.Players:GetPlayers()) do -- Here we loop through all of the players in the game again
local Character = Player.Character -- Here we get the character of that player
if Character then -- Here we check and make sure it's not nil
local HumanoidRootPart = Character.HumanoidRootPart -- Here we get the "HumanoidRootPart" of the players character
HumanoidRootPart.CFrame = Lobby.TeleportPoint.CFrame -- Here we set the cframe of the "HumanoidRootPart" to the TeleportPoint's cframe
end
end
ClonedMap:Destroy() -- When the round is over we destroy the map so that we don't end up with lots of maps in the workspace
end
local Status = game.ReplicatedStorage:WaitForChild("Status")
local TextLabel = script.Parent:WaitForChild("TextLabel") -- The text label that will display the status of the round
Status:GetPropertyChangedSignal("Value"):Connect(function() -- This function will fire when the "Status" value is updated
TextLabel.Text = Status.Value -- Here we set the text of our textlabel to whatever the "Status" value was updated to
end)