local ChangePart = game.Workspace.Part if ChangePart.BrickColor == BrickColor.Red() then ChangePart.BrickColor = BrickColor.Yellow() or ChangePart.BrickColor == BrickColor.Green() end
I need help with this please, I want it so if it is red, it will change to yellow, or if it is not red it will change to green, please help. xD
You've got two errors in your script. The first one is that you are using or in the wrong place. In an if statement, you need else if you want to do something if the condition of the if statement isn't true.
Secondly, you only need one equals sign on line 6. One equals sign =
is for assigning values and two equals signs ==
is for comparing values, such as your condition in line 3.
Your script should look like this when you fix both of these errors:
local ChangePart = game.Workspace.Part if ChangePart.BrickColor == BrickColor.Red() then ChangePart.BrickColor = BrickColor.Yellow() else --Else is used if the condition above is not met. ChangePart.BrickColor = BrickColor.Green() --One = sign for assigning values, two = signs for comparing values. end
I hope this helped you. If my answer helped, be sure to accept it. :)
Link for conditional statements.
Link for the list of operators you can use.
You have two errors.
The first being that you need to replace or with else. Else is for if statements.
The second being that you used two equals signs (==) on line 6 when you should have only used one.
Here's the fixed script.
local ChangePart = game.Workspace.Part if ChangePart.BrickColor == BrickColor.Red() then ChangePart.BrickColor = BrickColor.Yellow() else ChangePart.BrickColor = BrickColor.Green() end
Hope this helped.
If there's more than one part in workspace, I suggest renaming that part.