How to detect if gui x position increased or decreased

Hello! i would like to make a moving gui character, so when it moves forward or backwards then other guis move too.

but i don’t know how to detect if the x position increased or decreased…

i tried to make guis move when you press arrow keys but there’s what happens: (btw thats a invisible wall)
2021-11-06 23-59-00

local frame = script.Parent

frame:GetPropertyChangedSignal("Position"):Connect(function()
	--do stuff
end)
1 Like

Do like what @Limited_Unique did, but for the detecting you’ll need to add a few stuff…

local frame = script.Parent
local currentPos = frame.Position

frame:GetPropertyChangedSignal("Position"):Connect(function()
   if frame.Position.X.Offset > currentPos.X.Offset then --Change offset to scale if you want
      --do stuff
      currentPos = frame.Position
   elseif frame.Position.X.Offset < currentPos.X.Offset then
      --do other stuff
      currentPos = frame.Position
   --do the same for the Y axis
   end
end)
3 Likes