[SOLVED] How to disable rotation by the X axis using AlignOrientation?

If the other ones don’t work, this one should work decently. Keep in mind that if the client pushes, it might look like it is moving, but on the server it is not.
Here’s my code,

local axisToLimt = {true, false, false}

script.Parent:FindFirstChildOfClass("AlignOrientation").Parent.Changed:Connect(function()
	if game:GetService("ServerStorage"):FindFirstChildOfClass("AlignOrientation") then
		game:GetService("ServerStorage"):FindFirstChildOfClass("AlignOrientation").Parent = script.Parent
	end
end)
script.Parent:GetPropertyChangedSignal("Orientation"):Connect(function()	
	if axisToLimt[1] == true then
		script.Parent:FindFirstChildOfClass("AlignOrientation").Parent = game:GetService("ServerStorage")
		script.Parent.Orientation = Vector3.new(0, script.Parent.Orientation.Y, script.Parent.Orientation.Z)
	elseif axisToLimt[2] == true then
		script.Parent:FindFirstChildOfClass("AlignOrientation").Parent = game:GetService("ServerStorage")
		script.Parent.Orientation = Vector3.new(script.Parent.Orientation.X, 0, script.Parent.Orientation.Z)
	elseif axisToLimt[3] == true then
		script.Parent:FindFirstChildOfClass("AlignOrientation").Parent = game:GetService("ServerStorage")
		script.Parent.Orientation = Vector3.new(script.Parent.Orientation.X, script.Parent.Orientation.Y, 0)
	end
end)

a bit messy because I didn’t refine it, but I hope it helps!

I’ve setup the AlignOrientation the same way as BodyGyro and for my surprise it doesn’t derail anymore! It still shakes a bit, but that shake is okay. Thank you!

Sorry for bumping a dead thread, but do you still have the place file? Clicking the link seems to lead to an ‘oops this page doesn’t exist’

This post a few down from the first one I linked has the models I was sharing:
What Method To Use When Trying To Make a Train Follow a Track - #31 by Deadstatic77