How to make a bullet hole lie on the surface

This is my script(not full script)

	if ray then
			bullet:Destroy()
			local hit = ray.Instance
			
			local hole = game.ReplicatedStorage.Holes.Concrete:Clone()
			hole.Name = "BulletHole"
			hole.Parent = workspace.BulletHoles
			hole.Position = mousePos
			hole.CFrame = CFrame.new(hole.Position,rayPos + lastPos)

			local weld = Instance.new("Weld")
			weld.Part0, weld.Part1 = hit,hole
			weld.C0 = hit.CFrame:Inverse()
			weld.C1 = hole.CFrame:Inverse()
			weld.Parent = hole
			
			game:GetService("Debris"):AddItem(hole,8)
			local model = hit:FindFirstAncestorOfClass("Model")
			if model then
				local humanoid = model:FindFirstChildWhichIsA("Humanoid") or nil
				if humanoid then
					if hit.Name == "Head" then
						humanoid:TakeDamage(math.random(100,112))
						hole:Destroy()
					else
						humanoid:TakeDamage(math.random(37,52))
						hole:Destroy()
					end
				end
			end

			task.spawn(function()
				task.wait()
				task.wait()
				tracer.Position = Vector3.new(0,1e7,0)
				tracer.Parent = workspace.VisualStorage
			end)
			break
		end
		if bullet.Parent == nil then
			bullet:Destroy()
			break
		end
		lastPos = bullet.Position
	end

I’m tried to use local hit,pos,normal but this won’t work in my script. Because hit = ray.Instance

1 Like

Raycasts also return positions, try setting the hole part to be at the CFrame of
CFrame.new(ray.Position) to start.

3 Likes

Change this to

hold.CFrame = CFrame.lookAt(ray.Position, ray.Position + ray.Normal)

I’m don’t need to use Ray.Position because rayPos same as Ray.Position, but i’m try Ray.Position i’m think nothing change maybe.

Okay! Thanks i will try, thanks again.

I’m forget that RayPos this is the bullet position, so this is not work if im use rayPos. I’m need use ray.Position how u said