Hello there, I’m not the best at coding so go easy on me lol. So I have a map (which is an model) that is meant to appear when the game starts, but instead, it appears during the intermission. I did the first script myself (which makes the map appears) while the others I got from a Youtube video (that makes the game timer, intermission etc.). I have a video below if you want a better explanation. Anything would help! ![]()
My script (most likely the problem)
local MapTable = { -- Map Table
1 -- Theres more maps but for the example theres one
}
local RandomNumber = math.random(1, #MapTable)
local RandomMap = MapTable[RandomNumber]
print(RandomMap)
local function Map () -- Chosen Map.
while true do
if RandomMap == 1 then
wait(10)
game.ReplicatedStorage.CastleTown.Parent = game.Workspace
wait(20)
game.Workspace.CastleTown.Parent = game.ReplicatedStorage
local RandomNumber = math.random(1, #MapTable)
local RandomMap = MapTable[RandomNumber]
print(RandomMap)
end
end
end
spawn(Map) -- Repeats the process
.
Scripts I got from the Youtube video (Regular script)
local roundLength = 20 -- Length of round.
local intermission = 10 -- Intermission for the next round.
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local GameAreaSpawn = game.Workspace.GameSpawn
local LobbySpawn = game.Workspace.LobbySpawn
InRound.Changed:Connect(function()
wait(1)
if InRound.Value == true then
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = GameAreaSpawn.CFrame
end
end
end)
local function roundTimer ()
while wait do
for i = intermission, 1, -1 do
InRound.Value = false
wait(1)
Status.Value = "Intermission: ".. i .." Seconds left!"
end
for i = roundLength, 1, -1 do
InRound.Value = true
wait(1)
Status.Value = "Game: ".. i .." Seconds left!"
end
end
end
spawn(roundTimer)
Local Script
local Status = game.ReplicatedStorage.Status
local TimerDisplay = script.Parent.Frame.TimerDisplay
Status.Changed:Connect(function()
TimerDisplay.Text = Status.Value
end)
Here’s the video.
robloxapp-20230414-1611597.wmv (3.4 MB)