✓ Accepted answer
The problem.
No introductions, let's cut to the chase. map is a number. A random number between 1, and the number of minigames. not an instance. Lots of people make that mistake. If you were to return the map, it would return the random number between 1 and the # of maps. Why? because that's how math.random works. Only on numbers. Recieve 2 numbers, return one number. Not an instance, a number.
The Solution.
Now that we have the problem. let's find the solution. In tables (GetChildren returns a table) We can use table[number] to find that index (or number) in a table. So how would we apply this to this script? Glad you asked.
minigames = game.Lighting.Minigames:GetChildren()
number = math.random(1,#minigames)
map = minigames[number]
The Finished Script
minigames = game.Lighting.Minigames:GetChildren()
number = math.random(1, #minigames)
map = minigames[number]
function Intermission()
wait(2)
for value = 35, 0, -1 do
wait(1)
game.Workspace.Timer.Value = "The game will start in "..value.." seconds."
end
wait(1)
game.Workspace.Timer.Value = "Which map will we choose?"
wait(3)
game.Workspace.Timer.Value = "Map: "..map.Name
return true
end
while true do
wait(1)
local Int = Intermission()
end
1 comment
Good answer! You completely solved my problem!