Ok,Say there were 4 bricks in a model - A,B,C,D
I want them to change colour, then revert to the previous colour one at a time, but in a randomized fashion. How would I make it so that the order they change colours in is randomized?
Ok,Say there were 4 bricks in a model - A,B,C,D
I want them to change colour, then revert to the previous colour one at a time, but in a randomized fashion. How would I make it so that the order they change colours in is randomized?
You can use math.random().
local children = model:GetChildren()
while wait(time) do -- put 'time' to how many seconds it takes to choose the next part
local choosen = children[math.random(1,#children)] -- math.random() chooses a number from 1 to the number of children, which is 4 in your case
local prevColor = choosen.BrickColor -- we store the previous color of the part
choosen.BrickColor = BrickColor.new(newcolor) -- put newcolor to a color that the part changes to. if you want to put a random color, change this to BrickColor:random()
wait(time) -- put 'time' to how many seconds it takes for part to return to the previous color
choosen.BrickColor = prevColor
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
That's the way to use it.