Saving leaderstats failing again?
Whether I buy a developer product, add or subtract money with the server my money will stay at the same amount, what have I done wrong?
01 | local datastore = game:GetService( "DataStoreService" ) |
02 | local MyMoney = datastore:GetDataStore( "MoneyData" ) |
03 | local MyRuby = datastore:GetDataStore( "RubyData" ) |
04 | local MyCrates = datastore:GetDataStore( "CrateData" ) |
05 | local Mymaxamnt = datastore:GetDataStore( "MaxAmountData" ) |
06 | local bsnss = datastore:GetDataStore( "BusinessOwned" ) |
08 | game.Players.playerAdded:connect( function (player) |
09 | local Money = Instance.new( "IntValue" , player) |
11 | local Ruby = Instance.new( "IntValue" , player) |
13 | local Crate = Instance.new( "IntValue" , player) |
15 | local maxamount = Instance.new( "IntValue" , player) |
16 | maxamount.Name = "MaxAmount" |
18 | Money.Value = MyMoney:GetAsync(player.UserId) |
19 | MyMoney:SetAsync(player.UserId, Money.Value) |
20 | Ruby.Value = MyRuby:GetAsync(player.UserId) |
21 | MyRuby:SetAsync(player.UserId, Ruby.Value) |
22 | Crate.Value = MyCrates:GetAsync(player.UserId) |
23 | MyCrates:SetAsync(player.UserId, Crate.Value) |
24 | maxamount.Value = Mymaxamnt:GetAsync(player.UserId) |
25 | Mymaxamnt:SetAsync(player.UserId, maxamount.Value) |
27 | game.Players.PlayerRemoving:connect( function (player) |
28 | MyMoney:SetAsync(player.UserId, Money.Value) |
29 | MyRuby:SetAsync(player.UserId, Ruby.Value) |
30 | MyCrates:SetAsync(player.UserId, Crate.Value) |
31 | Mymaxamnt:SetAsync(player.UserId, maxamount.Value) |