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: ~

Previous Thread :: Next Thread 
jared2valdez4 is not online. jared2valdez4
Joined: 10 Sep 2012
Total Posts: 1514
09 Nov 2012 11:10 PM
roblox gui to display number of people on each team
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
09 Nov 2012 11:15 PM
TeamColor = 'Team Color Here';

Teams = Game:GetService('Teams');
function get()
local num = 0;
for _, v in pairs(Game.Players:GetPlayers()) do
if v.TeamColor == BrickColor.new(TeamColor) then
num = num + 1;
end
end
return num;
end

script.Parent.Text = get();
Report Abuse
jared2valdez4 is not online. jared2valdez4
Joined: 10 Sep 2012
Total Posts: 1514
09 Nov 2012 11:21 PM
Not working it goes to 0
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
09 Nov 2012 11:27 PM
1.) Where did you place the script
2.) Do you have a team in the game
3.) Did you enter that team color into the script
Report Abuse
jared2valdez4 is not online. jared2valdez4
Joined: 10 Sep 2012
Total Posts: 1514
09 Nov 2012 11:28 PM
It works. But how would I make it dynamic so here is what I am tying to do :

Team A > [0]
Team B > [0]

Dynamic meaning is someone leaves or joins that other team the other one will update.
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
09 Nov 2012 11:40 PM
Try this out.

TeamColor = 'Team Color Here';
Teams = Game:GetService('Teams');
TeamPlayers = {};

function numChanged()
script.Parent.Text = #TeamPlayers;
end

function watch()
for _, plr in pairs(Game.Players:GetPlayers()) do
if plr.TeamColor == BrickColor.new(TeamColor) and not TeamPlayers[plr] then
table.insert(TeamPlayers,plr);
numChanged();
plr.Changed:connect(function(property)
if property == 'TeamColor' and plr.TeamColor ~= BrickColor.new(TeamColor) then
TeamPlayers[plr] = nil;
numChanged();
end
end)
end
end
Game.Players.PlayerAdded:connect(function(plr)
wait();
if plr.TeamColor == BrickColor.new(TeamColor) and not TeamPlayers[plr] then
table.insert(TeamPlayers,plr);
numChanged();
end
end)
end

watch();
numChanged();
Report Abuse
LUVMARIOLUIGI10000 is not online. LUVMARIOLUIGI10000
Joined: 16 May 2009
Total Posts: 1244
10 Nov 2012 12:02 AM
--Over complicated, and could probably be shortened. Oh well, works fine.

team1Table = {}
team2Table = {}
team1 = game:GetService("Teams").Team1
team2 = game:GetService("Teams").Team2
Team1Count = 0
Team1Count = 0

function GetCount()
p = game.Players:GetChildren()
for i = 1, #p do
if p[i].TeamColor == team1.TeamColor then
table.insert(team1Table,1,p[i])
elseif p[i].TeamColor == team2.TeamColor then
table.insert(team2Table,1,p[i])
end
end
for i,v in pairs(team1Table) do
if v then
Team1Count = Team1Count + 1
end
end
for i,v in pairs(team2Table) do
if v then
Team2Count = Team2Count + 1
end
end
end

function PlayerRemoved(player)
for i = 1, #team1Table do
if player.Name == team1Table[i].Name then
table.remove(team1Table,1,player)
Team1Count = Team1Count - 1
end
end
for i = 1, #team2Table do
if player.Name == tabm2Table[i].Name then
table.remove(team1Table,1,player)
Team2Count = Team2Count - 1
end
end
end

game.Players.PlayerAdded:connect(GetCount)
game.Players.ChildRemoved:connect(PlayerRemoved)
Report Abuse
jared2valdez4 is not online. jared2valdez4
Joined: 10 Sep 2012
Total Posts: 1514
10 Nov 2012 04:46 PM
@LUVMARIOLUIGI10000
His worked fine for my game.
Stop looking for attention and trying to act 'Smart'.
Report Abuse
Rukiryo is not online. Rukiryo
Joined: 04 Sep 2009
Total Posts: 1490
10 Nov 2012 04:56 PM
No kidding lol.
"So inefficient, oh well"
LOL.
You can act smart when you program a real language. Lua is a baby scripting language. You still can't call yourself a programmer for using it.
Report Abuse
LUVMARIOLUIGI10000 is not online. LUVMARIOLUIGI10000
Joined: 16 May 2009
Total Posts: 1244
10 Nov 2012 05:02 PM
Im not looking for attention, nor trying to look smart. It's a scripting helpers forum, you posted a question and I simply answered with a chunk of code. And @Rukiryo, I never called myself a programmer, nor smart.
Report Abuse
Rukiryo is not online. Rukiryo
Joined: 04 Sep 2009
Total Posts: 1490
10 Nov 2012 05:06 PM
You said "oh well" as if you would put up with it even though you were 'so above it'.
So yes, you did try to act smart. If you are mature enough, you'll accept it and let this thread die. Go fight somewhere else, troll.
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
10 Nov 2012 06:38 PM
@OP;

Did mine work ok?
Report Abuse
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
10 Nov 2012 06:42 PM
DONT HELP JARED PLEASE.
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
10 Nov 2012 07:46 PM
That's not jared.
Report Abuse
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
10 Nov 2012 07:49 PM
YEs it is...

his main got banned he made a new account..
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
10 Nov 2012 08:05 PM
lol it is jared. His game is on front page too, I think he copied quenty's?
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
10 Nov 2012 08:06 PM
>.<
Report Abuse
LUVMARIOLUIGI10000 is not online. LUVMARIOLUIGI10000
Joined: 16 May 2009
Total Posts: 1244
10 Nov 2012 08:37 PM
@Rukiryo, I said 'Oh well', because it was a messy code that was too long and over complicated, that's why I said 'Oh well, it still works.' I never tried to act smart, and it is efficient, just because it doesn't meet your standards doesn't mean it's 'inefficient'. And I don't need to insult other people by calling them 'trolls' to make myself feel better. Once again I said 'Oh well', becuase I know it's a messy and sorta bad code.
Report Abuse
Lapwn is not online. Lapwn
Joined: 03 Jun 2012
Total Posts: 5975
10 Nov 2012 08:40 PM
Your both morons for letting Jared trick you into turning against each other
Report Abuse
LUVMARIOLUIGI10000 is not online. LUVMARIOLUIGI10000
Joined: 16 May 2009
Total Posts: 1244
10 Nov 2012 08:40 PM
I apolagize if I made it seem that way, honestly I could do better then that, but I said that because I understood it was bad.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
10 Nov 2012 08:55 PM
"@LUVMARIOLUIGI10000
His worked fine for my game.
Stop looking for attention and trying to act 'Smart'."

"No kidding lol.
"So inefficient, oh well"
LOL.
You can act smart when you program a real language. Lua is a baby scripting language. You still can't call yourself a programmer for using it."

"You said "oh well" as if you would put up with it even though you were 'so above it'.
So yes, you did try to act smart. If you are mature enough, you'll accept it and let this thread die. Go fight somewhere else, troll."

What is both your problems? Last I checked this was a forum for helping. Both of them helped. I know I for one enjoy trying to come up with my own solutions for solved problems. Calm down.

@Ruk

Don't even for a SECOND imply that you're smarter than or above LUVMARIO, because you really aren't. These posts you made pretty much proved that. You tell LUVMARIO that he isn't "mature enough" when you make these comments yourself? Stop throwing your little tantrums and grow up. If you can't be nice and help, just go away.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
10 Nov 2012 08:55 PM
@LUV

Don't apologize. Nobody here deserves an apology except you.
Report Abuse
LUVMARIOLUIGI10000 is not online. LUVMARIOLUIGI10000
Joined: 16 May 2009
Total Posts: 1244
10 Nov 2012 09:02 PM
@Agent, thank you. Atleast someone can undertsnad my position on this.
Report Abuse
LUVMARIOLUIGI10000 is not online. LUVMARIOLUIGI10000
Joined: 16 May 2009
Total Posts: 1244
10 Nov 2012 09:11 PM
*understand.
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