How to make, that part will stay in same x and z?

Hi,
I have problem, that I need to block part, that it can free fall, but its x and z will be same, even when player push it, … . Is this possible? THX

Can u please use a translator like Deepl or Google translate? I don’t really understand what u mean.

1 Like

I need to make script, that will make, that part will stay on same x and z, but can move up and down

Do u mean the position y or the size y?

position on axis x and z…

1 Like

Using a BodyPosition you can just set the X and Z values of the MaxForce to a huge number and leave the Y value at 0. This way, the force will be applied to keep the part in position on the X and Z axis, but it won’t apply any force on the Y axis.

Here’s a little bit of code you can use:

local part = script.Parent

local bodyPos = Instance.new("BodyPosition")
bodyPos.Position = part.Position
bodyPos.MaxForce = Vector3.new(math.huge, 0, math.huge)
bodyPos.P = 1e6
bodyPos.Parent = part
5 Likes

When changing the Position, fill in the X and Z as the part’s X and Z but change the Y, eg.

part.Position = Vector3.new(part.Position.X, 1, part.Position.Z)

This can also be done for BodyForces and TweenService.