Error I get bad argument #2 to '?' (Vector3 expected, got number) 21:24:16.280 - Stack Begin
Error happens on line 4
function FireLaser(mouse, count)
local aimPos = mouse.hit.p
local bulletOrigin = BulletOrigin.Position
local distance = bulletOrigin - aimPos.magnitude
if Recoil < MaxRecoil then
Recoil = Recoil + 5
end
for i = 1, count do
local aimWithSpread = Vector3.new(aimPos.x + math.random(-(BulletSpread / 10) * distance, BulletSpread / 10 * distance), aimPos.y + math.random(-(BulletSpread / 10) * distance, BulletSpread / 10 * distance), aimPos.z + math.random(-(BulletSpread / 10) * distance, BulletSpread / 10 * distance))
local collision, collisionPos = CreateRaycast(player.Character.Head.Position, aimWithSpread, {
player.Character,
Camera,
workspace.BulletDump,
game.ReplicatedStorage
})

1 comment
which line? is it in the CreateRaycast function