Get value what changed

Hello developers i using a :Changed and how to get how more added to the value?

Just cache the last value:

local yourValue = --path to your value object
local oldValue = yourValue.Value
yourValue.Changed:Connect(function(new)
	local diff = new-oldValue
	print("Value difference:", diff)
	oldValue = new
end)

Okay, how to put it in a player.leaderstats?

Place it in your leaderstats script and replace yourValue with your leaderstats value reference(example: yourValue = Coins where Coins is a number value inside leaderstats).

1 Like

I tried it but it not working for me