As the title says, for some reason, the Changed event is not working,

local MultipliedValue = script.Parent
local OldVal = MultipliedValue.Parent:WaitForChild("OldValue")
local NewValue = MultipliedValue.Parent:WaitForChild("AngleValueVector3")

OldVal.Changed:Connect(function()
if  OldVal.Value > NewValue.Value.X then
	MultipliedValue.Value = 1
end
end)



OldVal.Changed:Connect(function()
if  OldVal.Value < NewValue.Value.X then
	MultipliedValue.Value = -1
end
end)

-- For example, the script strangely can't tell the difference between the numbers 27.101765439914341727 and  27.101765439914341726

3 comments

2

Try running " print(27.101765439914341727 == 27.101765439914341726)" and check what happens (Spoiler: It prints true.) Floating point ("decimal") values can only be so precise. Assuming that Lua's using "double precision", numbers only have a precision of up to 16 decimal places. You're looking for precision of up to 20 decimal places. In other words, you can't fix this without using a big number

0

Maybe try to get ONLY the number behind the decimal and check that.

0

@XAXA Thank you