Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I check the mouse position on screen?

Asked by 4 years ago
Edited 4 years ago

I am making a certain tool that I want to have a little gui pop up that will start going up from the mouse but no idea of how to find the mouse position

2 answers

Log in to vote
0
Answered by 4 years ago

I think you're looking for this: https://developer.roblox.com/en-us/api-reference/property/Mouse/Hit

0
It works with cframe not the pixels on the screen, or i am just an idiot PixelRankYT 20 — 4y
0
You want the Gui to be above the mouse, right? Try using the X and Y values User#37171 0 — 4y
0
oki PixelRankYT 20 — 4y
Ad
Log in to vote
0
Answered by
Y_VRN 246 Moderation Voter
4 years ago

Use a LocalScript for this:

local LocalPlayer = game:GetService("Players").LocalPlayer
local Mouse = LocalPlayer:GetMouse()
local MX, MY = Mouse.X, Mouse.Y -- Position on screen.

To check...

while true do
    print(MX, MY) -- prints position on output
    wait(.05)
end

More info here: https://developer.roblox.com/en-us/api-reference/class/Mouse

Answer this question