Hello, I have a ATM and I can Deposit and withdraw money from my balance and everything is working fien, but the datastore just doesn't save, but whenever I change the value manually (through console) it saves, it just doesn't save when I use the ATM. I dont get any errors. Any ideas?

Script:

local DSS = game:GetService("DataStoreService")
local MoneyDS = DSS:GetDataStore("CoinsDS")

game.Players.PlayerAdded:Connect(function(player)
	
	local BankBalance = Instance.new("IntValue", player)
	BankBalance.Name = "inBank"
	BankBalance.Value = 0
	
	local money = Instance.new("IntValue", player)
	money.Name = "Money"
	money.Value = 0
	
	local id1 = "Bank-"..player.UserId
	local id = "money-"..player.UserId
	local data = nil
	local data1 = nil
	
	pcall(function()
		data = MoneyDS:GetAsync(id)
		data1 = MoneyDS:GetAsync(id1)
end)
		if data ~= nil then
			money.Value = data
			BankBalance.Value = data1
		else
			money.Value = 0
			BankBalance.Value = 0
	end	
	while true do wait(300)
		player.Money.Value = player.Money.Value + 20
	end
end)

game.Players.PlayerRemoving:Connect(function(player)
	local id = "Money-"..player.UserId
	local id1 = "Bank-"..player.UserId
	MoneyDS:SetAsync(id, player.Money.Value)
	MoneyDS:SetAsync(id1, player.inBank.Value)
end)

Thank you.