Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

player:GetMouse() is getting deprecated?

Asked by 5 years ago
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

mouse:connect(function(key)

if key == "Q" then

print("this is local")


end

end)

basically this simple script just does not work, i don't know what is wrong used to work before

0
Is this a script or a local script? kittonlover101 201 — 5y
0
Local script on starter pack Igoralexeymarengobr 365 — 5y
0
the script says taht itself XD Igoralexeymarengobr 365 — 5y
0
I saw lol kittonlover101 201 — 5y

2 answers

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

You're almost right.

'KeyDown' is getting deprecated!

The new method is UserInputService.

Here is a good method on using it.

New Code:

game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.Q then
        print("Q was pressed")
    end
end)
0
Thank you! Igoralexeymarengobr 365 — 5y
0
Welcome kittonlover101 201 — 5y
Ad
Log in to vote
1
Answered by
CjayPlyz 643 Moderation Voter
5 years ago
Edited 5 years ago

The answer is no, :GetMouse() is no getting deprecated. But Mouse is outdated, there are others which have more features, like UserInputService and ContextActionService. https://developer.roblox.com/articles/Keyboard-Input-Methods

There are still ways to use :GetMouse() like Mouse.Target and Mouse.TargetSurface and many others which can be very useful, you can see all of them by going to the object browser and look for Mouse.

0
Thank you! Igoralexeymarengobr 365 — 5y

Answer this question