How do i get the centre of a gui 'Frame'

As the title explains, i’m wondering how i would go about getting the centre of a gui element called Frame.

Thanks in advance,
Dev_Taiga

I think this would work:

  local x_center = gui_element.AbsolutePosition.X + (gui_element.AbsoluteSize.X / 2)
  local y_center = gui_element.AbsolutePosition.Y + (gui_element.AbsoluteSize.Y / 2)

This would give you the center of the UI element in pixels.

2 Likes

Keep in mind that @C_Sharper solution only works only if the anchor point is set to 0,0

3 Likes