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 » Scripters
Home Search
 

Re: Leaderstats.

Previous Thread :: Next Thread 
haydebug2003 is not online. haydebug2003
Joined: 21 Jan 2012
Total Posts: 5302
27 Nov 2014 10:06 AM
I am trying to add "candy canes" to the players leaderstats at the end of each round but my script wont work. Do you know what is wrong?

for i,v in pairs(game.Players:GetChildren())
i:FindFirstChild("Candy Canes").Value = i:FindFirstChild("Candy Canes").Value+100
end)


haydebug2003
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
27 Nov 2014 10:07 AM
v, not i
i is the key and is actually a number
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
27 Nov 2014 10:07 AM
Use V, not I. I is a number. V is a value.
Report Abuse
haydebug2003 is not online. haydebug2003
Joined: 21 Jan 2012
Total Posts: 5302
27 Nov 2014 10:08 AM
The V still had a red line under it.


haydebug2003
Report Abuse
haydebug2003 is not online. haydebug2003
Joined: 21 Jan 2012
Total Posts: 5302
27 Nov 2014 10:09 AM
Nvm forgot to add do WOOPS


haydebug2003
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
27 Nov 2014 10:09 AM
lowercase v
Report Abuse
haydebug2003 is not online. haydebug2003
Joined: 21 Jan 2012
Total Posts: 5302
27 Nov 2014 10:09 AM
Output reads
09:09:30.621 - ServerScriptService.Script:31: attempt to index a nil value


haydebug2003
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
27 Nov 2014 10:13 AM
You are using FindFirstChild twice, and not even using it to check if the child exists.

Use it only once, and then don't use it again. When you use it the first time, check if it is nil before proceeding.
Report Abuse
haydebug2003 is not online. haydebug2003
Joined: 21 Jan 2012
Total Posts: 5302
27 Nov 2014 10:15 AM
I got it. If you want the script here it is.
for i,v in pairs(game.Players:GetChildren()) do
v.leaderstats["CandyCanes"].Value = v.leaderstats["CandyCanes"].Value+100
end


haydebug2003
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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