Best way to prevent bullet holes from doing this

I want to make it so bullet holes don’t float when the edge of a wall is shot but I can’t seem to figure it out.

Example

I understand that I will likely have to remake this script as I don’t think it’s possible to do this with my current script that uses decals but I don’t know.

Current Script (Shortened)
Evt.HitEffect.OnServerEvent:Connect(function(Player, Position, HitPart, Normal, Material, Settings)
	Evt.HitEffect:FireAllClients(Player, Position, HitPart, Normal, Material, Settings)
	
	local gun = Player.Character:FindFirstChildWhichIsA("Tool")
	
	if HitPart.Material == Enum.Material.Concrete or  HitPart.Material == Enum.Material.Cobblestone or HitPart.Material == Enum.Material.Pebble or  HitPart.Material == Enum.Material.Fabric then
		local a = Instance.new("Part", BulletModel)
		a.FormFactor = "Custom"
		a.TopSurface = 0
		a.BottomSurface = 0
		a.Transparency = 1
		a.CanCollide = false
		a.Size = Vector3.new(0.5, 0, 0.5)
		a.CFrame = 	CFrame.new(Position,Position-Normal) * CFrame.Angles(90*math.pi/180,math.random(0,360)*math.pi/180,0)
		a.BrickColor = BrickColor.new("Really black")
		a.Material = Enum.Material.Air

		local b = Instance.new('WeldConstraint')
		b.Parent = a
		b.Part0 = a
		b.Part1 = HitPart

		local c = Instance.new("Decal", a)
		c.Texture = "rbxassetid://"..concrete_bulletholes[math.random(1,5)]
		c.Face = "Top"
		--		c.Transparency = 0

		local d = Instance.new("PointLight", a)
		d.Color = Color3.new(0, 0, 0)
		d.Range = 0
		d.Shadows = true

		local e = Instance.new("Weld")
		e.Part0 = a
		e.Part1 = HitPart

		a.Parent = HitPart

        end
    end
end)

Thanks.

What I would do is fire a raycast from the 4 edges of the square backwards and if any of them don’t hit something, you can know to move the bullet hole a bit in the other direction to compensate or not place a bullet hole or whatever you would want it to do

You can check this part of the code:
local a = Instance.new(“Part”, BulletModel)
a.FormFactor = “Custom”
a.TopSurface = 0
a.BottomSurface = 0
a.Transparency = 1
a.CanCollide = false
a.Size = Vector3.new(0.5, 0, 0.5)
a.BrickColor = BrickColor.new(“Really black”)
a.Material = Enum.Material.Air

If you will set a.Anchored to true, it should work.