Making bullet holes without the use of raycasts?

Greetings, I’m wondering if it’s possible to make bullet holes without the use of raycasts, and using CFrames, is this possible?

I made a gun system, however I would like to add bullet holes, instead of just the bullet disappearing when touching a player/wall.

One way is the use of the Players mouse and to assign the Objects (Or Bullet Hole) position by using Mouse.Hit.p via a RemoteEvent if you want it visible to people

Im not sure why you wouldn’t use raycasts tho :confused:

Yes, it is possible to create bullet holes using CFrames. One way to do this would be to use a CFrame to position and orient the bullet hole at the point of impact.

Here is an example of how you can do this:

  1. When the bullet hits a player or wall, use the CFrame.new function to create a CFrame that represents the position and orientation of the bullet hole. You can use the position and normal vector of the point of impact to determine the position and orientation of the CFrame.
  2. Use the SetPrimaryPartCFrame function to set the CFrame of the bullet hole model or part to the CFrame you created in step 2. This will position and orient the bullet hole at the point of impact.

Here is an example of how you could use these steps to create a bullet hole when a bullet hits a player:

local bullet = script.Parent -- the bullet that hit the player
local bulletHole = script.BulletHole -- the model or part that represents the bullet hole
local player = bullet.Parent -- the player that was hit

-- Get the position and normal vector of the point of impact
local impactPosition = bullet.Position
local impactNormal = (impactPosition - player.PrimaryPart.Position).Unit

-- Create a CFrame for the bullet hole
local bulletHoleCFrame = CFrame.new(impactPosition, impactPosition + impactNormal)

-- Set the CFrame of the bullet hole model or part
bulletHole.PrimaryPart.CFrame

I’m welding the bullethole to the position of the mouse, however it goes to the center of the world, instead.

Or if I hit a dummy with it, it goes far off to the side.
image

								local BulletHole = Instance.new("Part", Folder)
								BulletHole.Size = Vector3.new(0.25,0.25,0.25)
								BulletHole.CanCollide = false
								BulletHole.CanTouch = false
								BulletHole.Massless = true

								local Weld = Instance.new("Weld", BulletHole)
								Weld.Part0 = BulletHole
								Weld.Part1 = Hit
								Weld.C0 = CFrame.new(MousePosition)

I’m unsure what you’re wanting me to do with the last part: bulletHole.PrimaryPart.CFrame, as it’s an incomplete statement.