I haven’t worked with the new raycast system much yet so I am a bit confused why this doesn’t work
the goal is for it to hit 12 times if ur close up
my code:
local function FireGun()
local ignorelist = {game.Players.LocalPlayer.Character}
t2:Play()
local position = mouse.Hit.p
for i = 1,12 do
local b = Instance.new("Part")
local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
raycastParams.IgnoreWater = true
table.insert(ignorelist,b)
local amount = .15
raycastParams.FilterDescendantsInstances = ignorelist
local epic = CFrame.Angles(r:NextNumber(-amount,amount),r:NextNumber(-amount,amount),0)
b.Parent = script.Parent
b.BrickColor = BrickColor.new("Bright yellow")
b.Material = "Neon"
b.Transparency = 0.25
b.Anchored = true
b.Name = "proj"
b.Locked = true
b.CanCollide = false
b.Size = Vector3.new(.1,.1,1)
local ray = workspace:Raycast(script.Parent.Barrel.Position,(CFrame.lookAt(script.Parent.Barrel.Position,position) * epic).p,raycastParams)
b.CFrame = CFrame.lookAt(script.Parent.Barrel.Position,position) * epic
proj:Create(b,.5,game.ReplicatedStorage.Guns[script.Parent.Name].Stats.Range.Value)
game.Debris:AddItem(b,.5)
script.Parent.Handle.FireSound:Play() if ray then game.ReplicatedStorage.Events.Shoot:FireServer(script.Parent,ray.Instance) end
end
end