How to lock x and z orientation on part

I need help with this, so I wanted to lock x and z axis of a part so it cant get pushed on the floor but i want the y axis to move freely, like how a Humanoid keeps its HumanoidRootPart straight. But I cant really find out how to do this.
I tried using AlignOrientation but i don’t really get it and I’ve searched a lot and i didn’t find anything that helped, also I don’t want CFrame manipulation.

1 Like

Isn’t BodyPosition for Position not Orientation?

oh wait i though you said position nevermind then

You can use collision groups! Or do you still want people to collide with it?

i do still want people to collide, i just dont want it to fall over like how a humanoid can stay upright all the time

Maybe you can set the orientation of the part, but set the Y orientation to the current one?

i found out how to do this, use BodyGyro and set its P to like 400000 then leave its MaxTorque to default