|
| 10 Jun 2014 01:47 AM |
Would this script work to count to see which team has more parts that are colored their team color?
Parts = {Lol1,Lol2,Lol3}
for i, v in pairs(game.Workspace.Lol:GetChildren()) do if #v.BrickColor == BrickColor.new("New Yeller") <= #v.BrickColor == BrickColor.new("Really Blue") then
print("Yellow Wins!!!")
end end |
|
|
| Report Abuse |
|
|
BLOXLUA
|
  |
| Joined: 16 Mar 2013 |
| Total Posts: 453 |
|
| |
|
|
| 10 Jun 2014 01:49 AM |
| Ok, how would I make it work? |
|
|
| Report Abuse |
|
|
BLOXLUA
|
  |
| Joined: 16 Mar 2013 |
| Total Posts: 453 |
|
|
| 10 Jun 2014 01:51 AM |
| How many different colors are there? |
|
|
| Report Abuse |
|
|
BaconSoap
|
  |
| Joined: 12 Sep 2010 |
| Total Posts: 1882 |
|
| |
|
uyoyalt
|
  |
| Joined: 16 Apr 2013 |
| Total Posts: 2860 |
|
|
| 10 Jun 2014 01:53 AM |
| Make a table, then do a for loop that if the brick color is new yeller, same at your others as well. |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 01:56 AM |
| But I already made a table for the parts, there were three (Lol1, Lol2 and Lol3). Which other table should I make? |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 02:00 AM |
I will explain what I was trying to do in my script:
Parts = {Lol1,Lol2,Lol3} --Table of the parts
for i, v in pairs(game.Workspace.Lol:GetChildren()) do --Getting all of the parts in workspace (The Lol's)
if #v.BrickColor == BrickColor.new("New Yeller") <= #v.BrickColor == BrickColor.new("Really Blue") then --Cheching to see ifthere are more parts that are colored New Yeller than Really blue
print("Yellow Wins!!!") --Announcing the winner :P
end end |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 02:01 AM |
for i, v in pairs(game.Workspace.Lol:GetChildren()) do bluecount = nil; yellowcount = nil; if v.BrickColor == BrickColor.new("New Yeller") then yellowcount = yellowcount + 1; elseif v.BrickColor == BrickColor.new("Really Blue") then bluecount = bluecount + 1; end end
if bluecount > yellowcount then print("Blue wins"); elseif yellowcount > bluecount then print("Yellow wins"); elseif bluecount == yellowcount then print("Tie game"); end
Pretty sure you can use something like that. Not even sure what you had the array Parts for.
|
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 02:03 AM |
Just realized that you are checking the entire workspace. If that is the case then swap this in for the for i,v in pairs line:
for i, v in pairs(game.Workspace:GetChildren()) do
Otherwise, you could just make a model named "Lol" and place all the bricks in there then loop through it using what I had at first:
for i, v in pairs(game.Workspace.Lol:GetChildren()) do |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 02:15 AM |
| Thank you so much, that really helped me |
|
|
| Report Abuse |
|
|