I can't get this script to work for some reason and I use WaitForChild, but it still doesn't work, help!
EDIT: Simplified this script with an equation, still doesn't run on online play.
local movenumber2 = script.Parent local SOP = movenumber2.Parent.Parent:WaitForChild('MillisecondsOnesPlace') local HTPI = SOP:WaitForChild('ImageLabel') local Hit3 = HTPI:WaitForChild('MillisecondsOnesPlaceHitValue') local Hit4 = movenumber2:WaitForChild('MillisecondsTensPlaceHitValue') Hit3.Changed:connect(function() local val = Hit3.Value if val == 10 then movenumber2.Position = UDim2.new(0,0,0,0) Hit4.Value = Hit4.Value + 1 else movenumber2.Position = UDim2.new(0,-2.3714e-16 - 36.31507936507811*val - 5.902976190479389*val^2 + 19.965928130514644*val^3 - 15.415625000001649*val^4 + 5.712210648148644*val^5 - 1.1729166666667565*val^6 + 0.13672288359789322*val^7 - 0.00848214285714342*val^8 + 0.0002177028218695024*val^9,0,0) end end)
Solution
.Changed
will only work on a localscript when handling with objects which are on the client such as a user interface.
It is not the elseif statements that aren't working, it's that the event is never being called.
The solution, assuming that you haven't already done so, would be to put this in a localscript.
Side Note
What you're doing now is quite inefficient.
You could do something similar to
movenumber2.Position = UDim2.new(0, val * -30, 0, 0)