Hello, I am trying to get the position of the mouse if the mouse has been moved!
More Detail: I am trying to make a script that will print the position of the players mouse on the X and Y, I searched up how to check if the properties have changed and it does not show what i am looking for.
For mouse movement, use UserInputService.InputChanged.
local UserInputService = game:GetService("UserInputService")
UserInputService.InputChanged:Connect(function(input, engine_processed)
if engine_processed then
return
end
if input.UserInputType == Enum.UserInputType.MouseMovement then
print("Mouse movement!")
end
end)
You can use UserInputService::GetMouseLocation to get the 2D mouse coordinates. It returns a Vector2 describing this
local mouse_location = UserInputService:GetMouseLocation()
print(mouse_location.X, mouse_location.Y)