Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is this bullethole not facing the surface direction?

I have this hitpart that displays where a bullet was fired (essentially bulletholes), but when it hits, i'm not completely sure how to orient it the way the side of a part it hit was oriented. I assumed it would just do it automatically, I was wrong. My code is here, any help is appreciated

	local hitpart = game.ReplicatedStorage.Hit:Clone()
	hitpart.Position = position
--	hitpart.Orientation = part.Orientation
	hitpart.Parent = game.Workspace
	game.Debris:AddItem(hitpart, 1)

(I commented out the orientation thing since that didn't work either, the part variable is the part it hit)

1 comment

0

Try to do: hitpart.Orientation = part.Orientation + Vector3.new(0, 90, 0)

1 answer

I believe the issue is that you're relying on the part the bullet hits rather than the position of the bullet itself. Both Mouse.Hit and raycasting will give you the CFrame of where the bullet hit (if you're using something like BodyVelocity then you can just use the CFrame of the bullet). You can then use the orientation of the part the bullet hits to determine the orientation of the bullet hole.

If you found this answer helpful, please consider marking as an answer and upvoting!

1 comment

0

Hey! Thank you for getting back to me, i'm gonna try something like this, but could you be a little more specific? CFrames give me a huge headache and i'm not sure what part of the CFrame i'd be using, also, what about when it hits terrain

This discussion is preserved as it was. New answers, comments, and votes are closed.