So my problem is this: When a mouse button is pressed and recorded by way of "UserInputService", it's KeyCode is returns as "Enum.KeyCode.Unknown".
Now, it returning that whenever, say, right mouse button is clicked is fine, the problem is that it returns that for any/all mouse buttons!
So, is there a way to properly return the KeyCode for mouse buttons with "UserInputService"? If not, what's the best alternative way to get the mouse button clicked? (preferably in Enum.KeyCode format)
Here's some code:
--Made in Local script in StarterGui. local Input_Service =game:GetService("UserInputService") Input_Service.InputBegan:Connect(function(input) print(input.KeyCode)--When you press any mouse button, you get "Unknown". end)
I hope this helps,
Thanks.
I am not aware of any keycode for mousebutton1, which explains why a mouse click returns an unknown keycode.
Why can’t you use the MouseButton1Down event?
local mouse = game.Players.LocalPlayer:GetMouse() function click() print (“yes”) end mouse.MouseButton1Down:Connect(click)
Getting mouse adds a ton of functionality since you can Mouse.Target and check if a player is clicking a magic part
I wrote this on my phone lol