How to lock part z position?

How can i lock part z position, i need it to be optimized because there will be a lot of parts.

We need more information because “lock part z position” doesn’t describe to us what you need.

  • What are you trying to accomplish?
  • Are you CFraming these Parts?
  • Are they Unanchored?
  • Why would locking the Z position make it more optimized?

I want to make game with 2d camera but with 3d models and i need models to be unanchored but them sometimes move from z position where player can move

Try searching “2d game” in the forums, I know I’ve seen a few solutions on here in the past.

I found out how to do it here is the script if someone need it.

local model = workspace.Model

local zpos = 0

model:GetPropertyChangedSignal("WorldPivot"):Connect(function()
	local pos = model.WorldPivot
	if pos.Z ~= zpos then
		model:PivotTo(CFrame.new(Vector3.new(pos.X, pos.Y, zpos)) * model.WorldPivot.Rotation)
	end
end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.