How to spread like a shotgun with direction? (new raycast system)

My bad, I should’ve used math.rad not math.deg, try this instead

local SpreadMax = 10 -- Spread in degrees
for i = 1, 6 do
	local ray = CFrame.new(RaycastStart, RaycastStart + Direction) * CFrame.fromEulerAnglesXYZ(math.rad(math.random(0, SpreadMax)), 0, math.rad(math.random(0,360)))
	caster:Fire(ray.Position, ray.LookVector * (Distance or 200), castBehavior)
end
5 Likes