Shoot from center of screen?

so shooting on my game (PC) just fires a remote with mouse.hit.p (which is the center of screen when shiftlocking). However this doesn’t work on mobile / tablet, how would i shoot from the center of teh screen where the cursor is?

Since Roblox treats touches on the screen like a mouse, you can’t really work around it. I’d suggest using a side button for shooting on mobile.

local Cam = workspace.CurrentCamera

local X2D = Cam.ViewportSize.X / 2
local Y2D = Cam.ViewportSize.Y / 2

i forgot how to convert screen2d position to 3d, but u get the idea

found it, its

local Cam = workspace.CurrentCamera
local Vec = Vector2.new(Cam.ViewportSize.X / 2, Cam.ViewportSize.Y / 2)

local PositionIn3D = Cam:ViewportPointToRay(Vec.X, Vec.Y).Origin -- Returns a 3d position of middle point in ur screen 
2 Likes