Im trying to make a bullet hole script where it positions and rotates a part to the face where the player shot. im attempting to make it unanchrored and attached with some kind of weld, so that when the shot part moves, the bullet hole moves with it. I have access to mouse.Target(CFrame) and mouse.Hit.Position(Vector3)
im not sure how to raycast, so if you do have any ideas with raycast, please share!
in this context: Bhole.CFrame = CFrame.new(Bhole.Position, Bhole.Position + raycast.Normal)
Bhole = the bullet hole
To get the raycast to work do something like:
local mousePos = uis:GetMouseLocation()
local unitRay = cam.ViewportPointToRay(cam, mousePos.X, mousePos.Y)
local cast = workspace:Raycast(unitRay.Origin, unitRay.Direction * 400, params)
if cast then
where as uis is userinputservice and cam is the workspace.CurrentCamera