Excession
|
  |
| Joined: 09 Sep 2011 |
| Total Posts: 2674 |
|
|
| 20 Aug 2014 03:25 PM |
This snippet of code was working perfectly untill today:
game.Players.PlayerAdded:connect(function (player) -- Set up money stats = Instance.new("IntValue") stats.Name = "leaderstats" stats.Parent = player money = Instance.new("IntValue") money.Name = "Money" money.Value = 100 -- starter money yo money.Parent = stats
end)
What is wrong? For some players it does not create the money stat (I checked the developer console and it said that leaderstats do not exist) |
|
|
| Report Abuse |
|
|
Krypticon
|
  |
| Joined: 12 Feb 2014 |
| Total Posts: 680 |
|
|
| 20 Aug 2014 03:29 PM |
Try this?
Game.Players.PlayerAdded:connect(function(player) local stats,money=Instance.new("IntValue",player),Instance.new("IntValue") stats.Name="leaderstats" money.Parent=stats money.Name="Money" money.Value=100 end)
Should work.
:) |
|
|
| Report Abuse |
|
|
MrCherrys
|
  |
| Joined: 28 Apr 2010 |
| Total Posts: 13469 |
|
|
| 20 Aug 2014 03:32 PM |
Do this the other way.
Get an Integer Value (IntValue), place it inside 'Script' and name the Interger Value 'leaderstats'. Get another Integer Value and place it inside 'leaderstats' and name it 'Money'.
Then put this into your script.
game.Players.PlayerAdded:connect(function(player) for _,v in pairs (script:GetChildren()) do v:Clone().Parent = p end end)
|
|
|
| Report Abuse |
|
|
|
| 20 Aug 2014 03:33 PM |
@OP
in your code that adds/removes/checks the stats, use WaitForChild, so that it makes sure its already there |
|
|
| Report Abuse |
|
|