when I load my player when trying to retrieve the data, I do not get an error or a success. on the other hand, the saving does work but randomly.
local DataService = game:GetService("DataStoreService")
local DataStore = DataService:GetDataStore("Doesnotd Matterrigh now")
game.Players.PlayerAdded:Connect(function(player)
local RetrieveData
local success, errorMessage = pcall(function()
end)
if success then
if RetrieveData then
player:WaitForChild("leaderstats").Days.Value = DataStore:GetAsync(player.UserId,player.leaderstats.Days.Value)
print("Retrived")
else
end
end
end)
game.Players.PlayerRemoving:Connect(function(player)
print(player," Has Left")
local days = player.leaderstats.Days.Value
local success, errorMessage = pcall(function()
DataStore:SetAsync(player.UserId,days)
end)
if success then
print("All Saved")
else
print(errorMessage)
end
end)

1 comment
I re-wrote my answer, tested it, should work :)