This function returns a
DataType/Vector2 representing the current screen location of the player’s
Mouse in pixels relative to the top left corner. This does not account for the
If the location of the mouse pointer is offscreen or the players device does not have a mouse, the value returned will be undetermined instead of Vector2.
UserInputService is client-side only, this function can only be used in a
Move GUI To Mouse Location
This example binds the moveToMouse() to
RunService/BindToRenderStep|RunService's RenderStep to move the
GuiObject|GUI to the location of the player’s mouse.
In order for this example to work as expected, it should be placed in a
LocalScript that is a child of the GUI being moved to the mouse’s location.