✓ Accepted answer
There's a few things wrong with this:
First of all, in the 'maps' table you need to add speech marks around the string-values, like this:
local maps = {"Map1", "Map2", "Map3", "Map4", "Map5"}
Then instead of using normal brackets in line 2 use square brackets, and you need to call the table- like so:
local randomMap = maps[math.random(1, #maps)]
Finally, now you've called a value from the table you can use that- so you would do this:
clone = game.Lighting:FindFirstChild(randomMap):Clone()
clone.Parent = Game.Workspace
Now if you put all of that together you should get:
local maps = {"Map1", "Map2", "Map3", "Map4", "Map5"}
local randomMap = maps[math.random(1, #maps)]
clone = game.Lighting:FindFirstChild(randomMap):Clone()
clone.Parent = Game.Workspace
This should work, hope it helps! :)
1 comment
Great, thanks!