I want to make my projectile rotate depending on where it is going like a rocket. If it is going up, its face will be rotated towards air and it will rotate towards ground when it starts to fall down. Like this:
You could make a script that takes the velocity of the rocket and then orient it after doing some calculations. Because having a positive Y value means it points more up, having a negative Y value means it points more down. Same with the other X and Z values but rotated differently for them.
local bulletLength = bullet.Size.Z/2
local offset = CFrame.new(0, 0, -(length - bulletLength))
bullet.CFrame = CFrame.lookAt(lastPoint, lastPoint + direction):ToWorldSpace(offset)
(change “bullet” to whatever you have the bullet parameter named as, length to the displacement parameter, lastPoint to the lastPoint parameter, and direction to the rayDir parameter)
This code will make the rocket point towards the direction of its velocity, giving the rotation you want