I need help with an auto select map script

I have a problem with this part of the script:

local mapselect = game.ReplicatedStorage.Games:GetChildren()
local choose = math.random(1,#mapselect)
curnum = 0
for i =1,#mapselect do
curnum = curnum +1
if curnum == choose then
mapselect[i]:Clone().Parent = workspace
curnum = mapselect[i].Name
s.Value = "We’ll be playing "…mapselect[i].Name
end
end

  When I have to select a random folder, only one of those folders goes and the other one appears but the Intermission is blocked on the screen and it doesn't teleport me anymore, can you tell me why?
2 Likes

This should fix it


local mapselect = game.ReplicatedStorage.Games:GetChildren()

local chosenmap = mapselect[math.random(1,#mapselect)]

chosenmap:Clone().Parent = game.Workspace
s.Value = "We’ll be playing "... chosenmap.Name
2 Likes