Hey guys. I recently got into datastores (for saving data of course), and came across a crucial problem..
local popcornToSave = plr.leaderstats.Popcorn.Value
local success, err = pcall(function()
popcornSave:SetAsync(plr.userId, popcornToSave)
end)
if not success then
print("DATASTORE ERROR | " .. err .. " | Player UserID:" .. plr.userId)
else
print("Successfuly saved data!" .. popcornToSave)
end
Note: Take that 'plr' is defined as 'LocalPlayer', I have just cut off the function part. It is in the PlayerRemoved event by the way.
Now, the thing is, every time I leave the game, it prints "Successfuly saved data!0", even though I don't have 0 in my leaderstat! It's definitely not zero, as I can see it in the leaderstat..
Any help appreciated, and thanks in advance!

3 comments
this is bad code ur making my head hurt
Maybe it would be easier if you explain what the leaderstat is?
Also thats not how you find a leaderstat