local DSService = game:GetService('DataStoreService'):GetDataStore('fishingcoins2141yeass')
game.Players.PlayerAdded:Connect(function(plr)
local uniquekey = 'id-'..plr.userId
local char = game.Workspace:WaitForChild(plr.Name)
local savevalue = char:FindFirstChild("Coins")
local GetSaved = DSService:GetAsync(uniquekey)
if GetSaved then
savevalue.Value = GetSaved[1]
else
local NumbersForSaving = {savevalue.Value}
DSService:SetAsync(uniquekey, NumbersForSaving)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local uniquekey = 'id-'..plr.userId
local char = game.Workspace:WaitForChild(plr.Name)
local savevalue = char.Coins
savevalue.Name = 'Coins'
DSService:SetAsync(uniquekey, savevalue.Value)
end)
COMMUNITY QUESTION
Why does my database refuse to save any values when the player leaves?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
https://scriptinghelpers.org/help/how-post-good-questions-answers and copied from https://www.youtube.com/watch?v=tOOS9lMIYes