I am making a zombie survival game and i wanted to add mobile support to it, and im trying to make it as comfortable as possible for mobile players.
Currently, there are about 5 mobile buttons, one spawns your mount, one reloads your weapon, one scopes in with scoped weapons and the last one makes the gun shoot.
The weapons work fine for computer players, you click where you want to shoot, and the hitscan bullet goes to where you clicked, but instead of making so you click on mobile, i want to make so you need press the “shoot” button (that only appears on mobile) to shoot, the hitscan bullet will also go to where the crosshair (that also only appears on mobile) is.
However, i don’t know how to make that and i don’t want to add a bunch of extra code to my guns for it to work, but i will do that if it is the only option. Can anyone help me out?
my issue is making so once you press the “shoot” button, it makes so the bullet goes to where the crosshair is, i already made the mobile buttons and most of them work, besides the “shoot” one.
that is the issue, i have no idea on how to make a code that makes the gun shoot to where the mobile crosshair is, since i was using “Mouse.Hit.p” for computer players, and the crosshair is not the mouse.
You can bind a function with contextactionservice to Enum.UserInputType.Touch and get where the mobile player touched on the screen as a direction, mainly with Camera:ViewportPointToRay()