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?
local datastore = game:GetService("DataStoreService")
local MyMoney = datastore:GetDataStore("MoneyData")
local MyRuby = datastore:GetDataStore("RubyData")
local MyCrates = datastore:GetDataStore("CrateData")
local Mymaxamnt = datastore:GetDataStore("MaxAmountData")
local bsnss = datastore:GetDataStore("BusinessOwned")
game.Players.playerAdded:connect(function(player)
local Money = Instance.new("IntValue", player)
Money.Name = "Money"
local Ruby = Instance.new("IntValue", player)
Ruby.Name = "Rubys"
local Crate = Instance.new("IntValue", player)
Crate.Name = "Crates"
local maxamount = Instance.new("IntValue", player)
maxamount.Name = "MaxAmount"
Money.Value = MyMoney:GetAsync(player.UserId)
MyMoney:SetAsync(player.UserId, Money.Value)
Ruby.Value = MyRuby:GetAsync(player.UserId)
MyRuby:SetAsync(player.UserId, Ruby.Value)
Crate.Value = MyCrates:GetAsync(player.UserId)
MyCrates:SetAsync(player.UserId, Crate.Value)
maxamount.Value = Mymaxamnt:GetAsync(player.UserId)
Mymaxamnt:SetAsync(player.UserId, maxamount.Value)
game.Players.PlayerRemoving:connect(function(player)
MyMoney:SetAsync(player.UserId, Money.Value)
MyRuby:SetAsync(player.UserId, Ruby.Value)
MyCrates:SetAsync(player.UserId, Crate.Value)
Mymaxamnt:SetAsync(player.UserId, maxamount.Value)
end)
end)

5 comments
Just a suggestion, I suggest you save the values as a table, so you don't have to keep putting set async
Also, are you changing the values with a script, or manually? Because for some reason, if you change it manually, those changed stuff won't be saved
I've saved through a script, but i tested the game with my friend and our values for money and rubys are combining, i had 5k rubys and he had 0 i rejoined and had 0 rubys and 950,000 cash when i only had 530,000 before
And I dont know how to make it a table
i sent you a message