I have this script, but the stats only appear for the first person to join, by this I mean the 1st person to join gets their stats on the leaderboard but the others just have blank spots. How can I fix this? Here is my code.
01 | local ds = game:GetService( "DataStoreService" ):GetDataStore( "Stats" ) |
02 | game.Players.PlayerAdded:connect( function (np) |
03 | local ls = Instance.new( "BoolValue" ) |
04 | ls.Name = "leaderstats" |
05 | local level = Instance.new( "NumberValue" ) |
06 | level.Name = "Level" |
07 | local xp = Instance.new( "NumberValue" ) |
08 | xp.Name = "XP" |
09 | xp.Parent = ls |
10 | local kills = Instance.new( "NumberValue" ) |
11 | kills.Name = "Kills" |
12 | kills.Parent = ls |
13 | level.Parent = ls |
14 | ls.Parent = np |
15 | kills.Value = 0 |
This means you made a typo somewhere around the end, that makes the script break, the only way to fix this is to look for that typo, so that it can re-enter within the function, i would suggest starting a roblox-studio server, and then joining via ALT+F7 so that you can easily find the line that the script is crashing