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: Leaderboard problems!

Previous Thread :: Next Thread 
Alpal425 is not online. Alpal425
Joined: 29 Mar 2011
Total Posts: 214
31 Dec 2013 04:26 PM
Ok, so I found this on the wiki:
local playerStats = {} --this keeps a list of the stats for each player that enters the game

game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Model", player)
leaderstats.Name = "leaderstats"

local money = Instance.new("IntValue", leaderstats)
money.Name = "Money"
money.Value = 0

playerStats[player] = leaderstats
end)

while true do --infinite loop
for player, stats in ipairs(playerStats) do --loops through each player => stat pair in the table
stats.Money.Value = stats.Money.Value + 5
end
wait(10)
end

I thought I would try this out because I read through the whole page on the wiki (so not cheating! :3)...

But it doesn't work and no errors show up in the output. I read over the entire script (new to scripting)..it seems like it would work but it doesn't! Please explain why it doesn't work and what I could do to fix it! I am new to scripting and I need a money leaderboard plus I want to learn how leadership boards work and the wiki isn't helping me. :/
Report Abuse
BlackBucketBoy is not online. BlackBucketBoy
Joined: 22 Jul 2011
Total Posts: 3230
31 Dec 2013 04:27 PM
You didn't add anything in the table.
Report Abuse
Alpal425 is not online. Alpal425
Joined: 29 Mar 2011
Total Posts: 214
31 Dec 2013 04:50 PM
Table?
Report Abuse
SpiritOfRedemption is not online. SpiritOfRedemption
Joined: 04 Oct 2012
Total Posts: 279
31 Dec 2013 05:27 PM
*facepalm*

local playerstats={} is the table and

leaderstats being a model hasn't worked for me in awhile just replace it with an IntValue.
Report Abuse
Alpal425 is not online. Alpal425
Joined: 29 Mar 2011
Total Posts: 214
31 Dec 2013 05:30 PM
Ok then how would I write that. >.<

local IntValue = {}

Very confused on this line, I never understood it but always understood the rest.
Report Abuse
SpiritOfRedemption is not online. SpiritOfRedemption
Joined: 04 Oct 2012
Total Posts: 279
31 Dec 2013 05:34 PM
you don't change the table...
Report Abuse
SpiritOfRedemption is not online. SpiritOfRedemption
Joined: 04 Oct 2012
Total Posts: 279
31 Dec 2013 05:39 PM
--removed playerstats because honestly you don't need it here
game:GetService("Players").PlayerAdded:connect(function(Player)
local ls=Instance.new("IntValue",Player)
local money=Instance.new("IntValue",ls)
ls.Name="leaderstats"
money.Name="Money"
while true do
money.Value=money.Value+5
wait(10)
end
end)

just use that...
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