C4 placement problem

Helo. so i made a C4 tool, when activated, the explosives will fly towards the mouse and stick to the surface. The problem is that the charging is rotated incorrectly (this can be seen in the photos). To make it clearer what I want to achieve, I drew an image of the correct rotation of explosives (the blue arrow indicates the direction of the front of the charge) and the wrong rotation.
I want to achieve the same charge rotation as in the second drawing.

if this information is needed: i use FastCast to throw C4

ingame incorrect rotation


Thank you for any help

1 Like

Raycast result returns a property called Normal, which is the face it landed on in vector format.
In order to make your C4 face the right way, do:

C4.CFrame = CFrame.new(result.Position, result.Position+result.Normal)
-- ex. result.Normal is Vector3.new(1, 0, 0)

(sorry for long answer)
i tried to do this, and it didn’t work

is there any other way?