generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Will this work?

Previous Thread :: Next Thread 
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
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 is not online. BLOXLUA
Joined: 16 Mar 2013
Total Posts: 453
10 Jun 2014 01:48 AM
No.
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
10 Jun 2014 01:49 AM
Ok, how would I make it work?
Report Abuse
BLOXLUA is not online. BLOXLUA
Joined: 16 Mar 2013
Total Posts: 453
10 Jun 2014 01:51 AM
How many different colors are there?
Report Abuse
BaconSoap is not online. BaconSoap
Joined: 12 Sep 2010
Total Posts: 1882
10 Jun 2014 01:51 AM
By making it work
Report Abuse
uyoyalt is not online. 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
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
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
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
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
Legoman654 is not online. Legoman654
Joined: 05 Jun 2008
Total Posts: 534
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
Legoman654 is not online. Legoman654
Joined: 05 Jun 2008
Total Posts: 534
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
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
10 Jun 2014 02:15 AM
Thank you so much, that really helped me
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image