Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to move parts to or near a players position?

Asked by 3 years ago

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 answer

Log in to vote
1
Answered by
Pupppy44 671 Moderation Voter
3 years 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 243 — 3y
0
Yea beated me to it and your answer is nice so I will up vote you. Tizzel40 243 — 3y
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) Ziffixture 6913 — 3y
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 104 — 3y
0
Ima need this explaining to me, does anyone have a discord TheJeffyBrothers69 9 — 3y
Ad

Answer this question