LocalScript setting brickcolor based on brickcolorvalue does nothing? [CLOSED]
Asked by
5 years ago Edited 5 years ago
Edit: Closed because for some reason it started working after making no changes whatsoever. Bizarre, but glad it is working now?
Hello!
In my game I need to set the color of multiple parts based on a random BrickColorValue which is sharing the same parent as the localscript. It is a simple script, and should be working, but there are no errors and nothing happens.
The code:
01 | local val = script.Parent.treeType |
02 | val.Value = math.random( 1 , 5 ) |
03 | local val 2 = script.Parent.leafColor |
04 | val 2. Value = BrickColor.Random() |
05 | local val 3 = script.Parent.trunkColor |
06 | val 3. Value = BrickColor.Random() |
08 | local children = workspace.Model.Tree 1 :GetChildren() |
09 | for i, child in ipairs (children) do |
10 | if child.Name = = "Leaves" then |
11 | child.BrickColor = val 2. Value |
13 | if child.Name = = "Trunk" then |
14 | child.BrickColor = val 3. Value |
I apologize if the error is simple and I just missed it. This is honestly quite weird for me.
Thanks!