Throw this inside an image label. An intValue named SecondsTensPlaceHitValue is a child of the lmagelabel. The
This script does not work in play mode at all , but in studio it does, which is my problem.
local movenumber2 = script.Parent local Hit3 = script.Parent.Parent.Parent.SecondsOnesPlace.HundredThousandsPlaceImage.SecondsOnesPlaceHitValue local Hit4 = script.Parent.SecondsTensPlaceHitValue Hit3.Changed:connect(function() if Hit3.Value == 1 then movenumber2.Position = UDim2.new(0,-16,0,0) end end) Hit3.Changed:connect(function() if Hit3.Value == 2 then movenumber2.Position = UDim2.new(0,-33,0,0) end end) Hit3.Changed:connect(function() if Hit3.Value == 3 then movenumber2.Position = UDim2.new(0,-50,0,0) end end) Hit3.Changed:connect(function() if Hit3.Value == 4 then movenumber2.Position = UDim2.new(0,-66,0,0) end end) Hit3.Changed:connect(function() if Hit3.Value == 5 then movenumber2.Position = UDim2.new(0,-82,0,0) end end) Hit3.Changed:connect(function() if Hit3.Value == 6 then movenumber2.Position = UDim2.new(0,0,0,0) Hit4.Value = Hit4.Value + 1 end end)
You need to use WaitForChild for any object not in direct ancestry. Also, it is really bad practice to use more than one Changed function. I don't quite understand what you are doing but I hope this pattern works:
local movenumber2 = script.Parent local SOP = movenumber2.Parent.Parent:WaitForChild('SecondsOnesPlace') local HTPI = SOP:WaitForChild('HundredThousandsPlaceImage') local Hit3 = HTPI:WaitForChild('SecondsOnesPlaceHitValue') local Hit4 = movenumber2:WaitForChild('SecondsTensPlaceHitValue') Hit3.Changed:connect(function() local val = Hit3.Value if val == 6 then movenumber2.Position = UDim2.new(0,0,0,0) Hit4.Value = Hit4.Value + 1 else movenumber2.Position = UDim2.new(0,-16.6*val,0,0) end end)