Well I understand a bit of Lua but I need help on this if statement.
function Game.Workspace.Part1 = P1 Game.Workspace.Part2 = P2 if P1 and P2 = new.Color("Bright red") then --Here is my problem, how do you say color like this? Print("They are both red!") end
Anyone know?
Well number 1, you're using =
instead of ==
, number 2, the if statement is incorrect syntax, and number 3, new.Color
isn't valid syntax. This is how it should be written:
local P1 = game.Workspace.Part1 local P2 = game.Workspace.Part2 if P1.BrickColor.Name == "Bright red" and P2.BrickColor.Name == "Bright red" then print("They are both red!") end
Hope this helped!
*Note: if you still have trouble with using BrickColor, click here: BrickColor
P1 = Game.Workspace.Part1 P2 = Game.Workspace.Part2 if P1 == P1.BrickColor("Bright red") and P2 == P2.BrickColor("Bright red") then --Here is my problem, how do you say color like this? Print("They are both red!") end
This should fix it. But I don't exactly know if it will because of the 'colors'
Lol, I forgot that it can't be =, it has to be == :/
I don't know if it is supposed to be written like this, just try it out:
if P1 and P2 = BrickColor.new("Bright red") then
Hmm I have tryed all of them, It seems hard to do if statements with parts propertys.