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 Players

Previous Thread :: Next Thread 
XTSlasher is not online. 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 is not online. XTSlasher
Joined: 03 Feb 2014
Total Posts: 140
13 Feb 2014 05:46 PM
bump?
Report Abuse
wazap is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. XTSlasher
Joined: 03 Feb 2014
Total Posts: 140
13 Feb 2014 08:10 PM
Bump?
Report Abuse
XTSlasher is not online. XTSlasher
Joined: 03 Feb 2014
Total Posts: 140
13 Feb 2014 09:21 PM
Bring
Up
My
Post
Report Abuse
wazap is not online. 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 is not online. 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
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