My goal is to make a script that when a 25 second intermission is over, will spawn a map that is randomly chosen.
However, local mapName will return 1 (there is only 1 map), saying "1 is not a valid member of Folder “ReplicatedStorage.Maps” - Server - GameHandler:6
I searched on Google, DevForum, and YouTube, but nothing fixed my issue, only making it worse
local gameStatus = game.ReplicatedStorage:WaitForChild("GameStatus")
local gameTimer = game.ReplicatedStorage:WaitForChild("TimerStatus")
local lobbyCFrame = workspace:WaitForChild("Lobby"):WaitForChild("SpawnLocation").CFrame + Vector3.yAxis*5
local maps = game.ReplicatedStorage.Maps:GetChildren()
local mapsLength = #maps
local random = math.random(1, mapsLength)
local mapName = game.ReplicatedStorage.Maps[random]
local INTERMISSION = 25
while true do
for countDown = INTERMISSION, 0, -1 do
gameStatus.Value = "Intermission"
gameTimer.Value = countDown
task.wait(1)
end
gameStatus.Value = "Starting Game"
task.wait(5)
gameStatus.Value = "Map Name: "..mapName
task.wait(5)
local map = mapName:Clone()
map.Parent = workspace
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.