Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you get the local player's mouse's position in Vector2 value and not in Vector3 value?

1 answer

✓ Accepted answer

There are many ways you can do this, you can use the Mouse's X and Y properties, or UserInputService.

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
print(Mouse.X, Mouse.Y)
local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(Input, GPE)
        if GPE then return end
        print(Input.Position.X, Input.Position.Y)
end)

UserInputService.InputChanged:Connect(function(Input, GPE)
        if GPE then return end
        print(Input.Position.X, Input.Position.Y)
end)

UserInputService.InputEnded:Connect(function(Input, GPE)
        if GPE then return end
        print(Input.Position.X, Input.Position.Y)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.