I been trying four hours on how to change the raycasts CFrame to be like a funnel shoot and spread.


function shot(player,mousehit,tool)
	--mousehit = mouse.Hit.p
	math.randomseed(tick())
	local spread = 60
	local ray = Ray.new(tool.Handle.tip.CFrame.p, (mousehit - tool.Handle.tip.CFrame * CFrame.Angles(math.random(-120,120),math.random(-120,120),0).p).unit * 30)
	local hit, position = workspace:FindPartOnRay(ray, player.Character, false, true)
 	print(hit)
	local beam = Instance.new("Part", workspace)
	beam.BrickColor = BrickColor.new("Black")--customTrail)
	beam.FormFactor = "Custom"
	beam.Material = "Neon"
	beam.Transparency = 0.25
	beam.Anchored = true
	beam.Locked = true
	beam.CanCollide = false 
 	print(spread)
	local distance = (tool.Handle.tip.CFrame.p - position).magnitude
	beam.Size = Vector3.new(0.1, 0.1, distance)
	beam.CFrame = CFrame.new(tool.Handle.tip.CFrame * CFrame.Angles(math.random(-120,120),math.random(-120,120),0).p, position) * CFrame.new(0, 0, -distance / 2) 
	print(spread)
	game:GetService("Debris"):AddItem(beam, 0.1)
		
	if hit then
		if hit.Parent:FindFirstChild("Humanoid") or hit.Parent.Parent:FindFirstChild("Humanoid") then
			if hit.Name == "Right Leg" or "Left Leg" or "Right Arm" or "Left Arm" or "Torso" then
				hit.Parent.Humanoid:TakeDamage(pistolStats.Damage)
			end
			if hit.Name == "Head" then
				hit.Parent.Humanoid:TakeDamage(pistolStats.HeadShot)
			end
			if hit.Name == "Accessory" then
				hit.Parent.Parent.Humanoid:TakeDamage(pistolStats.Damage)
			end 
		end
	end
end