I wrote this script and something seems to be wrong. I have no idea what it is so can someone look it over and help me out. Thanks.
while wait(1) do math.randomseed(tick()) local value = math.random(1,8) Color = script.Parent.BrickColor if value == 1 then Color = BrickColor.new("Really Red") elseif value == 2 then Color = BrickColor.new("Lime green") elseif value == 3 then Color = BrickColor.new("Hot pink") elseif value == 4 then Color = BrickColor.new("New Yeller") elseif value == 5 then Color = BrickColor.new("Toothpaste") elseif value == 6 then Color = BrickColor.new("Burnt Sienna") elseif value == 7 then Color = BrickColor.new("Really black") elseif value == 8 then Color = BrickColor.new("Peral") end end
Your script is reading line 4 as a line it needs to remember, not as a property that needs to be changed. Just removing the .BrickColor from that line will make the script remember the value as a object, which if you reference it later in the script with .BrickColor afterward. The script will realise that you're intending to change the value of the object.
while wait(1) do math.randomseed(tick()) local value = math.random(1,8) Color = script.Parent --Just remove the .BrickColor and the script will recognize the 'Color' variable as a object. if value == 1 then Color.BrickColor = BrickColor.new("Really Red") --Adding the .BrickColor to the end of the variable will make the script realise it is a property needing to change. elseif value == 2 then Color.BrickColor = BrickColor.new("Lime green") elseif value == 3 then Color.BrickColor = BrickColor.new("Hot pink") elseif value == 4 then Color.BrickColor = BrickColor.new("New Yeller") elseif value == 5 then Color.BrickColor = BrickColor.new("Toothpaste") elseif value == 6 then Color.BrickColor = BrickColor.new("Burnt Sienna") elseif value == 7 then Color.BrickColor = BrickColor.new("Really black") elseif value == 8 then Color.BrickColor = BrickColor.new("Peral") end end
How your script was reading it before probably was like this. Repeat randomseed: get a value: remember the part's BrickColor for later being Mid gray: if statement: value is equal to two: alright remember the BrickColor Lime Green: wait a second: alright randomseed: get value: remember Lime Green since that's the color of the Brick: value is 5: remember Toothpaste. And it just goes on just remember the changing variable instead of actually changing the property of the object.
I don't know if it changed but I think with BrickColor.new you don't put the name but the id of a color, here's a list of all of them: http://wiki.roblox.com/index.php?title=BrickColor_Codes