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: Leadboard fail![Fix my script?]

Previous Thread :: Next Thread 
xXLiLxJXx is not online. xXLiLxJXx
Joined: 15 Mar 2012
Total Posts: 687
02 May 2014 05:14 PM
function CreateStats(NewPlayer)
local MainStats = Instance.new("IntValue")
MainStats.Name = "leaderstats"
MainStats.Value = 0
end

function CreateCash()
local MainStats = Instance.new("IntValue")
local PointsValue = Instance.new("IntValue")
PointsValue.Name = "Cash"
PointsValue.Value = 100
PointsValue.Parent = MainStats
MainStats.Parent = NewPlayer
return MainStats
end

function CreateKills()
local MainStats = Instance.new("IntValue")
local PointsValue = Instance.new("IntValue")
PointsValue.Name = "Kills"
PointsValue.Value = 0
PointsValue.Parent = MainStats
MainStats.Parent = NewPlayer
return MainStats
end

game.Players.ChildAdded:connect(CreateStats,CreateCash,CreateKills)
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
02 May 2014 05:18 PM
Why 3 functions? Make it 1.
Report Abuse
xXLiLxJXx is not online. xXLiLxJXx
Joined: 15 Mar 2012
Total Posts: 687
02 May 2014 05:21 PM
I am planning on adding more into each function
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
02 May 2014 05:22 PM
if you want to easily add more stats, use this example script from the wiki

local stats = {"Eggs", "Chickens", "Pies"}

game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Model", player)
leaderstats.Name = "leaderstats"
for _, stat in pairs(stats) do
Instance.new("IntValue", leaderstats).Name = stat
end
end)

#nerdsunited
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