Guns that aren’t a pain on mobile

so basically when you have guns on mobile they generally are kind of annoying to use

they frequently shoot towards the move and jump buttons when you use them and it’s hard to aim without stopping your movement

so how would i go about making it so only on a mobile device a crosshairs appears in the middle of the players screen and they only shoot in that direction while still retaining being able to click to shoot for PC players?

Consider checking out ContextActionService. It lets you create buttons for mobile users that would otherwise be bound to keys for PC players (e.g. mouse1)
Otherwise, check out GameProcessed. It is part of UserInputService which will make sure that a GUI button was not pressed before it does your function. This would also stop mobile players from shooting when trying to jump, type, etc.

you should use something that jailbreak uses

the shoot buttons for mobile and one for reload too

no i know how that works I meant how would I make a cross hair that only appears for mobile players and only causes mobile players to shoot forward at that crosshair

Guns are generally painful. Can you show a video of what your gun system looks/feels like on mobile? And maybe a script handling mobile support?

There should be a crosshair on all devices.

uh currently it’s just a generic gun script that gives mouse.hit.position and im not entirely sure how mobile support works in roblox

Well for starters to put a crosshair on the screen you can use UserInputService.TouchEnabled (boolean) to tell whether or not a player is on mobile or not and hide/unhide a crosshair gui element.
To fire the bullet in the middle, you may need mobile specific code. Fire a raycast from the camera position and what it hits would be the mobile equivalent of mouse.hit.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.