Jail System Admin

So I have a model consists of 4 parts like a surrounding wall, how to move the model to player position, because when i use moveTo humanoidrootpart Position, it moves to above player, I want to move it around the on the player, like jail in Kohl’s or HD Admin, I put the model name with Jail , and put it on Server Storage

1 Like

Try this, where model is the jail, and player is the person you are putting in jail

local jail = game.ServerStorage:WaitForChild("Jail"):Clone()

jail:PivotTo(player.HumanoidRootPart.CFrame)
jail.Parent = workspace

What’s the different between that to moveTo(HumanoidRootPart.Position)

To put it simply, PivotTo is the updated version of Model:MoveTo(). But you can look at the api reference if you want here.

Thank you, last question, what’s the different between HumanoidRootPart.Position and HumanoidRootPart.CFrame

CFrame is a combination of Position and Orientation. It can be fairly difficult to learn, but here’s the api reference, or here’s a video explaining it. (Quite a long video though)

May I know why when I use moveTo(HumanoidRootPart.Position) Jail is clone to workspace but the position is above the player, not around the player?

I think model:MoveTo() will move the model upwards if something is in the way of it. In this case, it’s trying to get to the centre of the character, though the character’s limbs are getting in the way, so it moves up until it’s above the character.

Let me try using pivotTo when I’m on PC. Thanks for helping!

1 Like

Why Sometimes its spawn correctly, but sometimes it spawn infront of the player

hitbox issues with roblox perhaps?? is the model a union?

Could be because the middle of the jail is not the middle of the hitbox

1 Like

I make parts become union and i use setprimarypart into that union and change the primary part cframe, and works, thanks.