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

How do i get mouse's position in 2d Plan?

Hey, i wanted to know how i could grab mouse position via UserInputService or ContextAction, the only way i knew that i could do that was Getmouse, but now its pretty much gone...

2 comments

0

How is GetMouse gone?

0

i meant its getting deprecated, isn't it?

2 answers

local UserInputService = game:GetService("UserInputService")
local button = UserInputService:IsKeyDown(Enum.KeyCode.button here)
if button then
local mouse = game.Players.LocalPlayer:GetMouse()
print(mouse.hit.p)
end)

i believe this will work and it will print the position of the mouse when u press the key u want dont understand how it would work in 2d though since roblox is a 3d game

link to userinputservice here https://developer.roblox.com/api-reference/function/UserInputService/IsKeyDown

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