Number value gets ignored when comparing values

When Comparing Number values the script does not want to do the operation
Here is my script:

-- shift is the value the script is watching
local startingValue = shift

shift:GetPropertyChangedSignal("Value"):Connect(function()
	wait(0.5)
	if startingValue.Value > shift.Value then
		local startingValue = shift
        print("Bigger")
	elseif startingValue.Value < shift.Value then
		local startingValue = shift
		print("Smaller")
	else
		print("Nothing")
    end
end)

so what happens when the number value changes is the output prints “Nothing”
Even though the number value has Changed to a greater value.
I am not sure what is realy happening, or what to call this.

I have tried to look for solutions no the wiki and the dev forums with little luck.

What the script does is that it checks a value every time it changes and tells me if the value has gotten bigger or smaller

I’m having a difficult time wrapping my head around this.

You’re defining startingValue as shift, so:

local startingValue = shift

But what’s really boggling my head is that you’re changing the meaning of the variable that you already defined as shift.

if startingValue.Value > shift.Value then

You can’t just change the meaning of the variable from a preexistent variable to an entirely new one until you redefine it.

When I look at this more, it looks implied that startingValue is the equivalent to shift.Value.

OP, you need to give more details about what the script exactly does, it’s hard to fill in the blanks that we don’t know the answer to.

Here’s your problem. startingValue is the same as shift, so when shift changes, so does startingValue.

    local startingValue = shift.Value
......
    if startingValue > shift.Value then