Whenever I aim and fire at where the barrel is located, the bullets collide with each other, creating a small group of bullets. It’s hard to explain but you’ll see it after looking at this GIF:
https://gyazo.com/798a4cdfb0d5a7b91ce26b2de048a466
How do I stop this? What’s a solution? I’ve already tried ignore lists, but that doesn’t work, and I’ve already tried changing the gun’s barrel from a physical part to an attachment.
Server script:
local remote = game.ReplicatedStorage:WaitForChild(“Remotes”):WaitForChild(“GunEvent”)
local cam = game.Workspace.CurrentCamera
local bulletsFolder = game.Workspace.bulletsFolder
remote.OnServerEvent:Connect(function(player, barrelPos, mousePos)
local ray = Ray.new(barrelPos, (mousePos - barrelPos).Unit * 50)
coroutine.resume(coroutine.create(function()
local IgnoreList = {player.Character,
workspace.Camera,
cam,
bulletsFolder
}
for i,v in pairs(workspace:GetDescendants()) do
if (v:IsA("Accessory"))
or (v:IsA("Tool"))
or (v:IsA("Part")) and v.Transparency <= 0.5 then
table.insert(IgnoreList,v)
end
end
local part, position = game.Workspace:FindPartOnRayWithIgnoreList(ray, IgnoreList)
local dist = math.clamp((barrelPos - mousePos).Magnitude, 0.05, 50)
if part then
local humanoid = part.Parent:FindFirstChild("Humanoid")
if humanoid then
humanoid:TakeDamage(7)
end
end
local spread_amount = math.random(0.75,1.5)
position = Vector3.new(position.X + (spread_amount * spread_amount * math.random()),position.Y + (spread_amount * spread_amount * math.random()),position.Z + (spread_amount * spread_amount * math.random()))
remote:FireAllClients(player, part, position, dist, barrelPos)
end))
end)
So what I did for my ignore list was that I created a folder to where the bullets would be put after being fired in the workspace, then added that folder to my ignore list. It doesn’t work.