How do I get a random child from a folder?

I want to get a random child from the folder Mazes:
local Mazes = game.ServerStorage.Mazes

and set its parent to game.Workspace. Every solution I’ve tried so far did not work.

How do I get a random child from a folder?

1 Like
local Folder = game.ServerStorage.Mazes:GetChildren()

local Child = Folder[math.random(1, #Folder)]:Clone()

Child.Parent = game.Workspace
6 Likes