Hello everyone, I have a strange error as the data store displays the wrong value.
Example
-
Collect in the game
https://gyazo.com/5114faf3b993b52e42d9a7977a8e1a02.png -
Message after leaving the game
https://gyazo.com/54afbaa1a835c1df7b41a886c1435ca7.png -
After re-joining
https://gyazo.com/f9c1f7d033561d1b8f510672feab8bf1.png
Always return this value.
I tried to view some posts but did not find posts that fix my problem.
Code
local RawCoal,RawCopper
-- Get Data
local Suc, er = pcall(function()
-- RawMt
RawCoal = DataRaw:GetAsync("rc-",plr.UserId)
end)
if Suc then
-- RawMt
rc.Value = RawCoal
else
print(er)
end
end)
-- When player leave the game
game.Players.PlayerRemoving:Connect(function(plr)
local sc,er = pcall(function()
DataRaw:SetAsync("rc-",plr.UserId , plr.RawMaterials.RawCoal.Value)
end)
if sc then
print("Worked and saved data")
else
print("Error "..er)
end
end)
If someone knows how to fix this, please help me, thanks.