I need to make this script to autosave but I dont know how, here is the script:

game.Players.PlayerAdded:Connect(function(plr)
	local stats = Instance.new("BoolValue",plr)
	stats.Name = "leaderstats"
	
	local cash = Instance.new("IntValue",stats)
	cash.Name = "Coins"
	cash.Value = 0

	local cash = Instance.new("IntValue",stats)
	cash.Name = "Gems"
	cash.Value = 500