So basically, I want to save the data, but for some reason, it doesn't save it.
--I just put a part of my code
function generateDataTable(player)
local CashPosition = game.ReplicatedStorage.PlayerCash:FindFirstChild(player.Name)
print("1")
if CashPosition then
print("2")
print(CashPosition.Value)
local dataTable = {
Cash = CashPosition.Value
}
print("3")
return dataTable
end
end
function saveDataForPlayer(player)
print("s")
local key = generateDataKey(player)
local data = generateDataTable(player)
print("Just one more thing !")
datastore:SetAsync(key, data)
print("set !")
end
--Oh and there is a PlayerRemoving event that is connected to the SaveDataForPlayer function
Let me explain: the CashPosition is an IntValue with the player's name (each player has one thing) because I first thought that data was not saved, because the leaderstats folder was already deleted from the game. So I created an IntValue that I put in ReplicatedStorage to use this value if the other one in leaderstats gets deleted.
So far it is printing up to ("Just one more thing !") so it does everything except the SetAsync function so I don't really know what to do in order for it to SAVE.

4 comments
Are you receiving any errors in the Output window?
nope
are you calling the function?
Yep, it prints everything up to the GetAsync() function which quite annoys me, and there are no errors in the output