How to get how more added to value?

I using a :Changed, and don’t know how to get number what added to value how to get it?

if you are trying to get how much the value changed by you need a variable for the old value and when changed subtract current value by old value to get the difference

local numberValue = ...
local savedValue = numberValue.Value

numberValue.Changed:Connect(function(value)
    local changedAmount = value - savedValue
    savedValue = numberValue.Value
    print(changedAmount)
end)
1 Like

You can keep track of the object’s value and get how much was added in a changed event:

local obj = --the path to your object
local Value = obj.Value

obj:GetPropertyChangedSignal("Value"):Connect(function()
   local difference = obj.Value - Value
   Value = obj.Value

end)

How i can do it here?

Before the clicks changed event, you can add variable “local CurrentClicks = clicks.Value” and replace the changed event code with:

local clickanim = player.PlayerGui.ClickAnim.Frame:Clone()
clickanim.LocalScript.Disabled = false
clickanim.Visible = true
clickanim.Parent = player.PlayerGui.ClickAnim

local change = clicks.Value - CurrentClicks
clickanim.TextLabel.Text = "+".. change
CurrentClicks = clicks.Value
clickanim.Position = GetRandomPosition()