I am trying to add mobile support. My plan is to make an automatic weapon that shoots when the player taps and holds and stops shooting when they release their finger. The problem with Tool.Activated is that on mobile, it is signaled when the tap ends, and when checking if the UserInputService.InputBegan InputObject.InputType is Enum.InputType.Touch, is that when I move, it somehow does not handle it, so you cannot move without shooting. How can I proceed?

So here are the problems: Tool.Activated runs on touch ended, not began

UserInputService.InputBegan InputType == Touch is better but still the following problems occur:

Does not differentiate between using the tool and activating the move joystick.

Does not differentiate between using the tool and changing the camera angle.

A solution is detecting if the move joystick is being used, and if so, then don't activate the tool. And for the camera angle part, maybe if the touch starts out as a dragging motion then ignore it, else if it starts out a tap, start shooting, and then drags won't matter. But how can I implement these solutions reliably?

2 comments

0

You can do Tool.Equipped, and then from there check if they're on mobile, if they are do your method of tap and hold.

0

You can check doing, if UserInputService.TouchEnabled == true then -REST OF CODE- end