Hi, so here is my script with an if statement in it:
01 | p 1 = game.Workspace.p 1 |
02 | b = math.random( 1 , 2 ) |
03 |
04 | print (b) |
05 |
06 | if b = = 1 then |
07 | color = "white" |
08 | end |
09 |
10 | if color = = "white" and |
11 | p 1. BrickColor = = "White" then |
12 | p 1. Transparency = 0 else |
13 | p 1. Transparency = 1 |
14 |
15 | if b = = 2 then |
Even when b is "white" and p1's Brick color is "White," p1's transparency is 1. Same goes with red.
Anyone know why this isn't working properly?
So I'm assuming you want to change the bricks color depending on if b is 1 or, 2. With that, I redid your script to:
01 | p 1 = game.Workspace.p 1 |
02 | math.randomseed(tick()) --This makes sure that the math.random will never stay as just one or just two, if you put it before the math.random it will never always be one color. |
03 | wait() --Slight delay |
04 | b = math.random( 1 , 2 ) |
05 |
06 | print (b) |
07 |
08 | if b = = 1 then |
09 | color = "White" |
10 | elseif b = = 2 then --elseif check to see if b ~=something, but does it == something else. |
11 | color = "Bright red" |
12 | end |
13 |
14 | if color = = "White" then |
15 | p 1. BrickColor = BrickColor.new(color) --you can replace color with any of the brick colors, "Bright purple", "Bright green" etc. |