Still have questions? Join our Discord server and get real time help.
0

# How to move parts to or near a players position?

So I know basic scripting and I'm practising to script by making an admin gui and one of the options I want on it is a "Jail Player" option, but how do teleport the jail to player so that the target is trapped inside and cant get out.

1
Pupppy44 458
9 days ago

You can move their HumanoidRootPart.

local Dummy = workspace:WaitForChild("Dummy") -- There's a dummy in the workspace for example

Dummy.HumanoidRootPart.CFrame = CFrame.new(workspace.Part.Position)
-- We're changing the RootPart's CFrame to a Part (in workspace)'s Position

0
Nice Answer ! Tizzel40 225 — 9d
0
Yea beated me to it and your answer is nice so I will up vote you. Tizzel40 225 — 9d
1
Regular Scripts don't normally require WaitForChild. You can also use :SetPrimaryPartCFrame(), it's redundant to adjust a CoordinateFrame if the CFrame is constructed with position only (you could've just used :MoveTo(Vector3) Feahren 5485 — 9d
0
If the jail is too small, :SetPrimaryPartCFrame is ideal as :MoveTo moves the Model upwards until there is nothing obstructing it on the Y axis. Usage of :SetPrimaryPartCFrame can be justified. HollowMariofan 100 — 9d
0
Ima need this explaining to me, does anyone have a discord TheJeffyBrothers69 2 — 9d