Hello! So yeah, I stumbled across another problem in my script that I have no idea what is wrong with it. So I want my BrickColorValue to be changed every second. (Don't ask why, it is complicated) But when ever I try to change it, nothing happens and it basically disables the script. (None of the other things in the script works.) There is nothing in the output so I have no idea whats wrong.
Tool = script.Parent Value = Tool.BrickColorValue.Value while true do wait() Value = BrickColor.new("Bright red") wait(1) Value = BrickColor.new("Toothpaste") wait(1) Value = BrickColor.new("Lime green") wait(1) Value = BrickColor.new("Mid gray") wait(1) Value = BrickColor.new("Bright violet") wait(1) Value = BrickColor.new("Bright yellow") wait(1) Value = BrickColor.new("Bright orange") wait(1) end
You can't set a variable equal to a property value as it does not work like that. I have fixed the script for you and it should work now. If you have any other questions or there is an issue, please let me know.
Tool = script.Parent Val = Tool.BrickColorValue while true do wait() Val.Value = BrickColor.new("Bright red") wait(1) Val.Value = BrickColor.new("Toothpaste") wait(1) Val.Value = BrickColor.new("Lime green") wait(1) Val.Value = BrickColor.new("Mid gray") wait(1) Val.Value = BrickColor.new("Bright violet") wait(1) Val.Value = BrickColor.new("Bright yellow") wait(1) Val.Value = BrickColor.new("Bright orange") wait(1) end
Also, if you wanted to make the script shorter, you could place the values in a table and iterate over the table. Just a recommendation. This is how you would accomplish such a task:
Tool = script.Parent Val = Tool.BrickColorValue colors = {"Bright red", "Toothpaste", "Lime green", "Mid gray", "Bright violet", "Bright yellow", "Bright orange"} while true do wait() for i,v in pairs(colors) do wait(1) Val.Value = BrickColor.new(colors[i]) end end