Hey! Im trying to create a Map Voting system based in the workspace like Murder Mystery 2!
Whenever I choose a Random Map (in a function) it continuously returns Nil…
I’ve tried looking on the hub, and I’ve tried basically everything in my knowledge scripting wise
Im not even sure why this can be happening to be honest…
(function that chooses them)
local function randomMap()
local random = math.random(1,#mapsFolder:GetChildren())
local chosen = mapsFolder:GetChildren()[random].Name
if not table.find(selectedMaps, chosen) then
table.insert(selectedMaps,chosen)
print(chosen)
return chosen
else
randomMap()
end
end
(choose the random maps)
local map1 = mapsFolder:FindFirstChild(randomMap())
local map2 = mapsFolder:FindFirstChild(randomMap())
local map3 = mapsFolder:FindFirstChild(randomMap())
(line that is corrupt)
local map2 = mapsFolder:FindFirstChild(randomMap())