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

if statement to brickcolor? [closed]

Asked by 9 years ago

This question already has an answer here:

Not able to access team color?

i have tried making a button that will change color to blue when its red and green when its blue and red when its green, this is my script so far;

function zozh(PlayerWhoClicked)
    if script.Parent.BrickColor == ("Bright red") then
        script.Parent.BrickColor = BrickColor.new("Bright blue")
    elseif script.Parent.BrickColor == ("Bright blue") then
        script.Parent.BrickColor = BrickColor.new("Bright green")
    elseif script.Parent.BrickColor == ("Bright green") then
        script.Parent.BrickColor = BrickColor.new("Bright red")
    end
end

script.Parent.ClickDetector.MouseClick:connect(zozh)

I'm guessing the error is if "if script.Parent.BrickColor ==", does anyone know the correct way to make a if statement to a parts brickcolor?

Marked as Duplicate by BlueTaslem

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?