XTSlasher
|
  |
| Joined: 03 Feb 2014 |
| Total Posts: 140 |
|
|
| 13 Feb 2014 05:20 PM |
function cwt1Wins() local team = game.Teams:FindFirstChild("Team 1") local children = team:GetChildren() for i = 1,#children do local m = Instance.new("Message", Workspace) m.Text = "Winner: " ..children[i].Name local player = children[i]:GetPlayerFromCharacter(children[i]) local wins = player:FindFirstChild("Wins") local points = player:FindFirstChild("Points") wins.Value = wins.Value + 1 points.Value = points.Value + 1 end end
Would this work for adding changing values of players on a team??? |
|
|
| Report Abuse |
|
|
XTSlasher
|
  |
| Joined: 03 Feb 2014 |
| Total Posts: 140 |
|
| |
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 13 Feb 2014 06:15 PM |
local player = children[i]:GetPlayerFromCharacter(children[i])
should be
local player = game.Players:GetPlayerFromCharacter(children[i])
|
|
|
| Report Abuse |
|
|
XTSlasher
|
  |
| Joined: 03 Feb 2014 |
| Total Posts: 140 |
|
|
| 13 Feb 2014 06:22 PM |
I tried that, it still didn't work..
Updated Script:
function cwt1Wins() local team = game.Teams:FindFirstChild("Team 1") local children = workspace:GetChildren() for i = 1,#children do if children[i]:IsA'DataModel' then if children[i].Humanoid ~= nil then local character = game.Players:FindFirstChild(children[i].Name) local m = Instance.new("Message", Workspace) m.Text = "Winner: " ..children[i].Name local wins = player:FindFirstChild("Wins") local points = player:FindFirstChild("Points") wins.Value = wins.Value + 1 points.Value = points.Value + 1 end end end end |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 13 Feb 2014 06:28 PM |
I'm srry but this line
if children[i]:IsA'DataModel' then
What. |
|
|
| Report Abuse |
|
|
XTSlasher
|
  |
| Joined: 03 Feb 2014 |
| Total Posts: 140 |
|
|
| 13 Feb 2014 06:29 PM |
It's saying that if the child of workspace is a datamodel, which is what players are, then continue the conditional...
I don't want all children of workspace...
Just players.. |
|
|
| Report Abuse |
|
|
XTSlasher
|
  |
| Joined: 03 Feb 2014 |
| Total Posts: 140 |
|
| |
|
XTSlasher
|
  |
| Joined: 03 Feb 2014 |
| Total Posts: 140 |
|
| |
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 13 Feb 2014 09:25 PM |
children[i]:IsA'DataModel'
Basically that statement means if the object == game then which... oddly, is never going to be true. |
|
|
| Report Abuse |
|
|
XTSlasher
|
  |
| Joined: 03 Feb 2014 |
| Total Posts: 140 |
|
|
| 14 Feb 2014 07:07 AM |
| Well, even more oddly, it does... It's just doesn't call to the player in Players service... :( |
|
|
| Report Abuse |
|
|