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)

1 comment