code:

local datastoreservice = game:GetService("DataStoreService")
local myDataStore = datastoreservice:GetDataStore("myDataStore")
game.Players.PlayerAdded:Connect(function(player)
	local ls = Instance.new("Folder",player)
	ls.Name = "leaderstats"

	local Bites = Instance.new("IntValue",ls)
	Bites.Name = ("Bites")
	Bites.Value = 0

	local Coins = Instance.new("IntValue",ls)
	Coins.Name = ("Coins")
	Coins.Value = 0
local data
	local success , errormessage = pcall (function()
		data = myDataStore:SetAsync(player.UserId.."-Coins",player.leaderstats.Coins.Value)
	end)
	if success then
		Coins.Value = data
	else
		print ("There was an error gettin your data")
		warn(errormessage)
	end
end)

game.Players.PlayerRemoving:Connect(function(player)
	local success, errormessage = pcall (function()
		myDataStore:SetAsync(player.UserId.."-Coins",player.leaderstats.Coins.Value)
	end)
	if success then
		print ("Data successfully saved")
	else
		print ("There was an error when saving data")
		warn (errormessage)
	end
	
end)

i got no errors however my Coins won't save

##[Edit by JesseSong:]

Please ensure you've made clear of errors pertained with the script. Any errors, prints, etc, will be fundamental and will be great for the community to be well - equipped to answer your question!

Also, with that being said, make sure your question is descriptive and understandable to read. If you DON'T ensure the item listed above, then your question will fall into the category as "Non - Descriptive"

(In a summary, make sure you've enforced these features enumerated above, and counteract the atrocities!)

If you want to learn how to make a good question then click this hyperlink!

Thanks, JesseSong!