How do I detect when the right trigger is pressed on an Xbox controller?

So I have a gun that uses Player:GetMouse() to shoot. Problem is, I am trying to make my game console compatible but I can’t find a way to do the same thing when the right trigger is pressed on a controller like an Xbox controller. Is there any way around using Tool.Activated to do this?

You could use UserInputService.InputBegan and check if Enum.KeyCode.ButtonR2 (Right trigger) is pressed then make it fire your gun.

Documentation for UserInputService:
https://create.roblox.com/docs/reference/engine/classes/UserInputService

3 Likes