Hi! I was making an ability for a weapon and i wanted it to fire when i clicked RMB. However UserInputService is not detecting any of my mouse inputs.
Heres my code:
UserInputService.InputBegan:Connect(function(input, GPE)
if input.KeyCode == Enum.KeyCode.MouseRightButton then --This is where the error is happening
if GPE == false and abilityDebounce == false then
if weapon.Parent == character then
--Ability code
end
end
end
end)
Is there anyone else facing this issue?
How can i fix this?
The buttons of a mouse are disconnected from the keyboard; you’re using the wrong component of the InputObject provided to you by UserInputService.InputBegan. Make sure to use “UserInputType”