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
 

Workspace.Script:9: attempt to perform arithmetic on field 'Kills' (a userdata value)

Previous Thread :: Next Thread 
EpicMeep is not online. EpicMeep
Joined: 18 Jan 2011
Total Posts: 830
19 Nov 2011 10:17 PM
Output: Workspace.Script:9: attempt to perform arithmetic on field 'Kills' (a userdata value)

Script:
while true do
wait(1)
g = game.Players:GetChildren()
for i = 1, #g do
if g[i].TeamColor == game.Teams.Robloxians.TeamColor then
game.Teams.Robloxians.Score = game.Teams.Robloxians.Score + g[i].leaderstats.Kills
elseif g[i].TeamColor == game.Teams.Mutants.TeamColor then
game.Teams.Mutants.Score = game.Teams.Mutants.Score + g[i].leaderstats.Kills
end
end
end

What I am trying to do is make a teams score the number of KOs it`s players has combined. I do not understand this output...
Report Abuse
noobertuber is not online. noobertuber
Joined: 16 Jan 2007
Total Posts: 2321
19 Nov 2011 10:31 PM
You have to put .Value at the end of your integer and number value references. It can't change an object to a number.

Sincerely,
Noobertuber
Report Abuse
EpicMeep is not online. EpicMeep
Joined: 18 Jan 2011
Total Posts: 830
20 Nov 2011 08:59 AM
Oh! That makes since because in leaderstats the Kills and Deaths are a Value. Thanks.
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