Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Part Color Changing Script Problem?

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

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.