I have a game thats in first person, the gun manager uses mouse.Target as a way to get who youre shooting, since my game is first person, it doesnt matter that it uses mouse.Target because since its in first person you will not be able to zoom out and hit people around walls.
Anyway i want to know if you can make a shot gun spread using mouse.Target, i want the shot gun to have a wider range using mouse.Target and mouse.Hit.p. Is it possible to make the mouse target box a little bigger?
Where 10 is the intensity of the spread. It’s also recommended to not use the above method as is because it would be unrealistic because the shotgun will have insane spread at insanely close distances. Rather, you can use Camera:ScreenPointToRay() and UserInputService:GetMouseLocation() to do something like:
local UserInputService = game:GetService("UserInputService")
local length = 500
local spread = 10
local mouseLocation = UserInputService:GetMouseLocation()
local unitRay = camera:ScreenPointToRay(mouseLocation.X, mouseLocation.Y)
local destination = unitRay.Origin + unitRay.Direction * length
destination += Vector3.new(math.random()-0.5,math.random()-0.5,math.random()-0.5) * spread
local extendedRay = workspace:RayCast(unitRay.Origin, destination - unitRay.Origin)