Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UserInputService.GetMouseLocation()'s return type is Vector2 instead of Vector2 | undefined #548

Closed
vendkita opened this issue Mar 3, 2022 · 2 comments

Comments

@vendkita
Copy link

vendkita commented Mar 3, 2022

UserInputService.GetMouseLocation() return type is set to Vector2 instead of Vector2 | undefined.

In Roblox's API, it states:
"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"

https://developer.roblox.com/en-us/api-reference/function/UserInputService/GetMouseLocation

@osyrisrblx
Copy link
Member

Looks like this API will always return a Vector2 value. In the event that the user doesn't have a mouse or the mouse is off screen, the API will return something like Vector2(inf, inf), but not nil/undefined.

@osyrisrblx osyrisrblx transferred this issue from roblox-ts/roblox-ts Mar 27, 2022
@Validark
Copy link
Contributor

It's unfortunate that the documentation says "the value returned will be undetermined instead of Vector2"...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants