How To Only Affect The Position Of A Model On One Axis

Hi there. I’m trying to figure out a way to move a model/part in a way where it’s only affected on the Z axis. The reason why this is so important is because I’m building a script which keeps a part at -11 studs on the Z axis, but it should move freely on the X and Y axis to whatever physics are applied to it. In this script, it adjusts the position every RenderStepped. It keeps the part on the Z axis at -11 studs, but now the problem is that the part won’t move on the X or Y axis because the current script is constantly keeping it in the same place because even though the X and Y values are set to whatever position the object is already in, it adjusts the position of the object every RenderStepped, so before the object can react to the world’s physics it just constantly gets readjusted to that position, making the object immobile. Below is the script.

game:GetService("RunService").RenderStepped:Connect(function()

		game.Workspace.Model:MoveTo(Vector3.new(game.Workspace.Model.Part.Position.X, game.Workspace.Model.Part.Position.Y, -11))
	
end)

I ask for help from anyone to solve this issue with me. Thank you.

The part isn’t moving at all because you pretty much anchored the part by always setting its position to its position. Basically, it can’t really be moved by physics because its position is always set to its constant position if that makes sense…

Anyway, as a solution to your problem, you should check out this post as it probably has the answer you need.

I know that’s the problem. I said that in my post. Anyway, I’ll check out what you sent me.