Hello guys when i was developing my game a error is ocurred but nothing causes it on output the problem is when i equipped a gun and try move my camera on my phone the gun automatically shoots to my finger where i try to move the camera how can i disable it
(Idk what it causes so i dont know what to screenshot and send here but i can provide details if you need it to help me, thanks)
How do you exactly make the gun compatible with mobile???
im assuming you’re firing a gun when a player holds on the screen using InputBegan directly from the UserInputService or using tool.Activated without any buttons.
actually its not my gun system its my friend’s gun system he made it and gave me to use on my new game project but he made aim system and reload system but on mobile when u equipping a gun the gun automatically shoots when u try to move your camera it automatically shoots to my finger where i try to move the camera
so it’s triggered by UserInputService or a mouse, That triggers because mouse is considered as InputBegan and it works on touchscreen devices too, your gun system doesn’t seem to have some checking from the InputObject or it’s already added into the conditions but merged into one single inputs, Touchscreens don’t have an inputs that uses to move cameras.
because the only primary input it has were only the touch whereas others like Mouse, Keyboard and Controllers had multiple keybinds, touching the screen while swiping is considered as InputBegan except keyboards, mouse and controllers, what i’ll do is i’d create a button for the fire button and have the function for it’s own rather than inside InputBegan from UserInputService in one single functions, filter on the UserInputService.InputBegan
event to see if they’re not from touch screens, This basically prevents the function from running.
like i said earlier, you do that on both for the buttons that mobile users can see and main one for Keyboard, Mouse and Controllers
and what it’ll come out, looks like this
the gun system is like this (this is for akm gun) but it is the same for all guns
please help me to how to fix it, i would be very appreciated man i need support alot