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

What Is Wrong With My Button Part Color Changer Script?

A = game.workspace.Butt2
script.Parent.Touched:connect(function(Color)
if A.BrickColor == "Medium Stone Grey" then
print("Working")
game.Workspace.Butt2.BrickColor = BrickColor.new("Really Red")
elseif A.BrickColor == "Really Red" then
	A.BrickColor = BrickColor.new("Really Blue")
elseif A.BrickColor == "Really Blue" then
	A.BrickColor = BrickColor.new("Really Red")
end	
end)

My situation is I have this line of code inside a part, that is a button. I have another part a few studs away from the button. I just don't understand why it isn't working. I assumed that it might have been the fact that I stuck the code into an anonymous function, but It seemed to be that It didn't work, unless I failed to make a regular function as well.

Did I mess up on a line or something?

1 answer

✓ Accepted answer

When checking to see if something is a BrickColor, you still need to use BrickColor.new(), because BrickColor values are not strings.

Also, BrickColor values only have the first letter capitalised, like so:

BrickColor.new("Medium stone grey")

2 comments

0

Oh wow how could I've made such a mistake, thanks :)

0

np :P

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