I was wondering what was the point in UserInputService. For example, there is ContextActionService. ContextActionService is way more easier to work with (in my opinion) as it allows you to bind and unbind actions, you don’t have to worry about scripting a system where if your typing in chat and UserInputService is listening, that action occurs without the player intending to, and it even allows you to cater for mobile devices.
This is my first question I have ever asked on the Developer Forum so I am sorry if I posted this under the wrong category.
Although ContextActionService may be more easier to use, I believe UserInputService is much more flexible then ContextActionService and I’d argue that it actually is easier to use than ContextActionService.
Anything that ContextActionService can do, UserInputService can do the exact same thing with more flexibility and more usage.
ContextActionService is limited in a few things while UserInputService can:
Detect the gyroscope of a person’s device
Detect movements in screen touches, positions, etc
Detect focus on certain elements/windows
Keydown/other similar events (great for having hold jump and other actions that require holding onto the button.)
There are a few more though thats the basic jist, however, ContextActionService does have a few advantages that UserInputService kinda leans off however, imo, UserInputService can do very much similar things to ContextActionService.
(Please correct me if I’m wrong though, It’s just experience based off using it instead of ContextActionService )
Thanks for the reply! I’m not sure about the first 3 points however, you can detect whether a player is holding a key down or if the key is released (if that’s what you meant
) through using if inputState == Enum.UserInputState.Begin then end or
if inputState == Enum.UserInputState.End then end
ah, mistake on my end howver:
You can do the exact same thing without much hassle:
that returns a table of the current buttons being pressed down (check example)
this checks if a specifc key is being pressed down, easy to use and useful. (check example)