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 |
|
|
|
| 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
|
  |
| 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 |
|
|
| |
|
Adamnet
|
  |
| Joined: 08 Oct 2007 |
| Total Posts: 7673 |
|
| |
|
|
| 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
|
  |
| 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 |
|
|
|
| 12 Aug 2011 08:25 PM |
| adam, I'm asking the PARENT of the script. |
|
|
| Report Abuse |
|
|
Adamnet
|
  |
| Joined: 08 Oct 2007 |
| Total Posts: 7673 |
|
|
| 12 Aug 2011 08:26 PM |
| workspace same with the team1 numbervalue |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| Joined: 08 Oct 2007 |
| Total Posts: 7673 |
|
|
| 12 Aug 2011 08:34 PM |
| Still nothing the numbervalue is not changing :v |
|
|
| Report Abuse |
|
|
Adamnet
|
  |
| Joined: 08 Oct 2007 |
| Total Posts: 7673 |
|
| |
|
Adamnet
|
  |
| Joined: 08 Oct 2007 |
| Total Posts: 7673 |
|
| |
|
|
| 13 Aug 2011 10:19 AM |
| It is most likely you doing somethinng wrong. |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 13 Aug 2011 03:46 PM |
| We helped you my posting functional scripts. Must I apologize? |
|
|
| Report Abuse |
|
|