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 |
|
|
|
| 31 Dec 2013 04:27 PM |
| You didn't add anything in the table. |
|
|
| Report Abuse |
|
|
Alpal425
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 214 |
|
| |
|
|
| 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
|
  |
| 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 |
|
|
|
| 31 Dec 2013 05:34 PM |
| you don't change the table... |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|