How do I create a :GetChildren() that randomly picks a child?
1 | parent = workspace.Model |
2 |
3 | local rng = math.random( 1 , #parent:GetChildren()) |
rng is a random number between 1 and the amount of children the instance has.
If an instance has 5 children, it will be a number from 1 to 5.
With this we can select a random child from the instance.
1 | local child = parent:GetChildren() [ rng ] |