How do I check what the value was before :GetPropertyChangedSignal()?

I am making a system which detects when the cash value is changed so I can display it on a GUI, for example: “+100”.

But the issue is, I am not sure how I would print what the value was before the value was even changed. Does anyone know the solution to this?

Script so far:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		plr.Stats.Wallet:GetPropertyChangedSignal("Value"):Connect(function()
			print("value changed")
		end)
	end)
end)

Kon’nichiwa! :bowing_woman:t2:
You can record the property!
Here is an update of your code snippet to demonstrate what I mean.

local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(plr)
	local Stats = plr.Stats
	local Wallet = Stats.Wallet.Value
	Stats.Wallet:GetPropertyChangedSignal("Value"):Connect(function()
		print("value changed")
		--This is your old value.
		print(Wallet)

		--This updates your old value to your new value.
		Wallet = Stats.Wallet.Value
	end)

	plr.CharacterAdded:Connect(function(char)
	end)
end)

I added little notes to help you understand, if you need any more help with this, let me know!

2 Likes