Why won't this datastore script store data?
I'm not getting any errors from the script (I removed the pcalls to make sure)
Can someone help me out?
01 | local ds = game:GetService( "DataStoreService" ):GetDataStore( "ds" ) |
03 | game.Players.PlayerAdded:Connect( function (plr) |
04 | local key = "id-" ..plr.UserId |
05 | local Stats = Instance.new( "Folder" ,plr) |
06 | local Lvl = Instance.new( "IntValue" ,Stats) |
07 | local Exp = Instance.new( "IntValue" ,Stats) |
08 | local Exc = Instance.new( "IntValue" ,Stats) |
09 | local Pts = Instance.new( "IntValue" ,Stats) |
10 | local Arm = Instance.new( "IntValue" ,Stats) |
11 | local Dmg = Instance.new( "IntValue" ,Stats) |
12 | local Rei = Instance.new( "IntValue" ,Stats) |
21 | local info = ds:GetAsync(key) |
30 | if Lvl.Value = = 0 then |
33 | if Exc.Value = = 0 then |
34 | Exc.Value = Lvl.Value * 5 |
38 | while Exp.Value > = Exc.Value do |
39 | Lvl.Value = Lvl.Value + 1 |
40 | Exp.Value = Exp.Value - Exc.Value |
41 | Exc.Value = Lvl.Value * 5 |
45 | game.Players.PlayerRemoving:Connect( function (plr) |
46 | local key = "id-" ..plr.UserId |
48 | local Stats = plr:WaitForChild( "Stats" ) |
49 | local Lvl = Stats:WaitForChild( "Lvl" ) |
50 | local Exp = Stats:WaitForChild( "Exp" ) |
51 | local Exc = Stats:WaitForChild( "Exc" ) |
52 | local Pts = Stats:WaitForChild( "Pts" ) |
53 | local Arm = Stats:WaitForChild( "Arm" ) |
54 | local Dmg = Stats:WaitForChild( "Dmg" ) |
55 | local Rei = Stats:WaitForChild( "Rei" ) |
56 | table.insert(info,Lvl.Value) |
57 | table.insert(info,Exp.Value) |
58 | table.insert(info,Exc.Value) |
59 | table.insert(info,Pts.Value) |
60 | table.insert(info,Arm.Value) |
61 | table.insert(info,Dmg.Value) |
62 | table.insert(info,Rei.Value) |