What are the coordinates for an ScreenGui to be in the exact middle of players screen?

i really need that for my FPS game because the guns don’t have a crosshair i’ve been searching on Youtube for this but no one makes videos about such a small thing.
Thank you

1 Like

The position depends on the ui’s AnchorPoint. It can be easily put in the centre using the AnchorPoint (0.5, 0.5) and Position {0.5, 0}, {0.5, 0)

The AnchorPoint determines the origin of the ui’s Position in both dimensions. With the AnchorPoint (0, 0), the ui’s origin is situated at the top-left, and with AnchorPoint (0.5, 0.5), the ui’s origin is situated in the centre of the ui.

For AnchorPoint (0, 0) - Position: UDim2.new(0.5, -ui.AbsoluteSize.X / 2, 0.5, ui.AbsoluteSize.Y/2)

For AnchorPoint (1, 1) - Position: UDim2.new(0.5, ui.AbsoluteSize.X / 2, 0.5, ui.AbsoluteSize.Y /2 )

(Using UDim2 if you’re changing it in a script)

2 Likes

thank you for the detailed explication!