Help needed figuring out where to have gun bullets fly to

You are still in 2022?

What I’m concerned with in regard to getting the mouse is that it might make it much harder to make ports for Xbox and mobile. I don’t know if that’s unreasonable to believe but I don’t see how mouse.hit would translate to controllers and touchscreens.


I believe Mouse.Hit will work on console and mobile.
But Button1Down and stuff like that probably won’t work.

UPDATE: For whatever reason, this code is what worked:

raycastParams.FilterDescendantsInstances = {gun.Parent}
local raycastResult = workspace:Raycast(mouseRay.Origin, mouseRay.Direction * 1000, raycastParams)
if raycastResult then
	direction = handle.Barrel.WorldPosition + (raycastResult.Position - handle.Barrel.WorldPosition)
else
	direction = mouseRay.Origin + mouseRay.Direction * 1000
end

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