How to Get Mouse Position in Roblox
AffordingAggie路6 months agoUse the 'UserInputService' service! Just grab the mouse details using `UserInputService:GetMouseLocation()`. Easy peasy!
Win Roblox gift cards by playing games on Playbite!
Playbite
500k winners and counting...
More Answers
You can use `UserInputService:GetMouseLocation()`. It'll give you the X and Y coordinates of the mouse cursor on the screen.
Just use `UserInputService:GetMouseLocation()`. It returns a Vector2 with the screen position.
I found using `UserInputService:GetMouseLocation()` works perfectly. You can access it through a LocalScript like this:
```lua
local UserInputService = game:GetService('UserInputService')
UserInputService.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
local mousePos = UserInputService:GetMouseLocation()
print(mousePos)
end
end)
```
馃憖 If you like Roblox...
Diego路3 hours agoThe brands referenced on this page are not sponsors of the rewards or otherwise affiliated with this company. The logos and other identifying marks attached are trademarks of and owned by each represented company and/or its affiliates. Please visit each company's website for additional terms and conditions.
People also want to know
Add an Answer