How would I make 1 leaderstats value change into another leaderstats value?

Im trying to make a sell system for a simulator game and I was wondering how I would make the clicks value change into the cash value.

Heres my code:

script.Parent.Touched:Connect(function(hit)
	local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
	if player then
		local leaderstats = player:WaitForChild("leaderstats")
		local clicksvalue = leaderstats.Clicks.Value
		local cashvalue = leaderstats.Cash.Value
		
	end
end)
script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if player then
			player.leaderstats.Cash.Value += player.leaderstats.Clicks.Value
			
			player.leaderstats.Clicks.Value = 0
		end
	end
end)
1 Like

Thank you. This helped me out. This was exactly what I was trying to do!!