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

Part Color Changing Script Problem?

Asked by
Jiptix 2
9 years ago

Alright, so I am just getting started with lua, so I am working on some basic little scripts. I am working on a script that changes the color of the part that the script is in:

Part = script.Parent
while true do
Part.Brickcolor = "Bright red"
wait(1)
Part.Brickcolor = "Earth green"
wait(1)
end

The error message I am getting is: "Brickcolor is not a valid member of Part". I realize this is probably just a careless mistake, but please help me as I learn lua!

Thanks, Jiptix

1 answer

Log in to vote
1
Answered by
ZeroBits 142
9 years ago

There are two problems in your code. the first is that BrickColor should have the word 'Color' capitalized.

The second is that you're trying to set the color to a string. To change BrickColors, you need to do this:

Part.BrickColor = BrickColor.new("Bright red")
Part.BrickColor = BrickColor.new("Earth green")

BrickColor.new is the 'function' to get a BrickColor.

I run into the second problem myself a lot, but instead it's with positions, where I do Position = 1,1,1 instead of Position = Vector3.new(1,1,1)

And when I was a novice scripter I ran into the first problem every. single. time.

Hope this fixes your problem.

Ad

Answer this question