Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make a script where it will pick 1 brick out of like 10 bricks in a model?

Asked by
Bwc904 0
10 years ago

Its so I can make a random one catch on fire

1 answer

Log in to vote
0
Answered by 10 years ago

Lets say that the model is the scripts parent:

local Model = script.Parent
local RandomBrick = Model:GetChildren()[math.random(1, #Model:GetChildren())]

This uses math.random() to choose a random child from the scripts parent (the model).

Ad

Answer this question