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: team count script

Previous Thread :: Next Thread 
Adamnet is not online. Adamnet
Joined: 08 Oct 2007
Total Posts: 7673
12 Aug 2011 08:09 PM
i was wanting to find out how to make it so a script will count how many people are on a team and put it into a numbervalue

i tried this

wait(1)
team1 = game.Players:GetChildren()
if team1.TeamColor == "Bright red" then
script.Parent.team1.Value = script.Parent.team1.Value + 1
end

and it didnt work... Can anyone help?
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
12 Aug 2011 08:12 PM
for i,v in pairs(game.Players:GetChildren()) do
if v.TeamColor == BrickColor.new("Bright red") then
script.Parent.team1.Value = script.Parent.team1.Value + 1
end
end
Report Abuse
Adamnet is not online. Adamnet
Joined: 08 Oct 2007
Total Posts: 7673
12 Aug 2011 08:17 PM
Doesnt work. My team color is Bright red when im switched to it it never counts :(

However if i added a while true do (lol to spam) it worked but counted me every second xD
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
12 Aug 2011 08:18 PM
What is the script in?
Report Abuse
Adamnet is not online. Adamnet
Joined: 08 Oct 2007
Total Posts: 7673
12 Aug 2011 08:19 PM
by itself
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
12 Aug 2011 08:20 PM
function update(p,c)
if c == "TeamColor" then
if p.TeamColor == BrickColor.new("Bright red") then
script.Parent.team1.Value = script.Parent.team1.Value + 1
end
end
end

game.Players.PlayerAdded:connect(function() p.Changed:connect(function(c) update(p,c) end) end)
Report Abuse
Adamnet is not online. Adamnet
Joined: 08 Oct 2007
Total Posts: 7673
12 Aug 2011 08:24 PM
Didnt work. The script should be by itself in a script.
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
12 Aug 2011 08:25 PM
adam, I'm asking the PARENT of the script.
Report Abuse
Adamnet is not online. Adamnet
Joined: 08 Oct 2007
Total Posts: 7673
12 Aug 2011 08:26 PM
workspace same with the team1 numbervalue
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
12 Aug 2011 08:28 PM
Okay...

game.Players.PlayerAdded:connect(function(p)
p.Changed:connect(function(prop)
if prop == "TeamColor" then
if p.TeamColor == BrickColor.new("Bright red") then
workspace.team1.Value = workspace.team1.Value + 1
end
end
end)
end)
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
12 Aug 2011 08:31 PM
That is the exact same as mine except he puts the function in instead of calling it.
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
12 Aug 2011 08:32 PM
Oh, sorry, Bunny, I didn't notice it was the same.

OP, what's the output?
Report Abuse
Adamnet is not online. Adamnet
Joined: 08 Oct 2007
Total Posts: 7673
12 Aug 2011 08:34 PM
Still nothing the numbervalue is not changing :v
Report Abuse
Adamnet is not online. Adamnet
Joined: 08 Oct 2007
Total Posts: 7673
13 Aug 2011 07:56 AM
hello?
Report Abuse
Adamnet is not online. Adamnet
Joined: 08 Oct 2007
Total Posts: 7673
13 Aug 2011 09:36 AM
hello? lol
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
13 Aug 2011 10:19 AM
It is most likely you doing somethinng wrong.
Report Abuse
Adamnet is not online. Adamnet
Joined: 08 Oct 2007
Total Posts: 7673
13 Aug 2011 03:25 PM
I doubt it but maybe your right...

Its in Workspace alone, by itself. So is the value

The team color is Bright red.

Dunno what else could be a problem haha
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
13 Aug 2011 03:46 PM
We helped you my posting functional scripts. Must I apologize?
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