Why does this script not work?


i made a timer, then when the timer hits 0 it picks a random map but it’s stuck on the map choosing page, does anyone know why?

Does it ever hit “Map chosen…”? Show us your output

could you maybe show us all the code?

Unless you use the GetChildren() function out of a for loop, it will return a nil value. So here is your script.

local getMaps = game.Workspace.Tutorial:GetChildren()

local list = {}

for i, parts in pairs(getMaps) do		
    table.insert(list, math.random(1, #getMaps))
end

print(list[1]) -- To take the first element of the list because there will be as many elements as the number of maps.

Adjust the script if it is needed, I just named the parts myself.

thanks! that really helped! so thanks!

1 Like