ive got a script that creates leaderstats, loads leaderstats and saves leaderstats but its the saving part that doesnt work. For some unkown reason everything in this script works up to the pcall and everything after that just decides to not work and i have no idea why. This has been plagueing me for a whole 2 days and at least 20 hours of those 2 days ive spent trying to fix it so i will take any help
game.Players.PlayerRemoving:Connect(function(player)
print("player removing working")
local money = player.leaderstats.money.Value
local strength = player.leaderstats.strength.Value
local newplayer = player.leaderstats.newplayer.Value
print ("Variable assign working")
local dataDict = {
moneydata = money,
strengthdata = strength,
newplayerdata = newplayer,
}
local success, errormessage = pcall(function()
gameDataStore:SetAsync(player.UserId,dataDict)
end)
if success then
print("data saved")
else
print("data failed")
warn(errormessage)
end
print("why is this not working")
print(dataDict["moneydata"])
print("finished")
end)

4 comments
How are you sure that it's not your loading script that's flawed? Can you post that too?
Ive got a similar setup with the loading and it prints to console the success message
show the loading anyway
you know we can't help you if you post inadequate information right