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

Why doesn't Humanoid:MoveTo work or is PrimaryPart not working?

Asked by 2 years ago
local dummy = workspace.Dummy
local dummy2 = workspace.Dummy2
local dummyhum = dummy.Humanoid
dummyhum:MoveTo(dummy2.PrimaryPart.Position)

Hi I am trying to move "Dummy" to "Dummy2" which is stationary in my workspace. Please help I am unsure of why my code does not work!

0
Try using dummy.PrimaryPart instead of dummy.Humanoid NotThatFamouss 605 — 2y
0
Make sure to unanchor all of the BaseParts inside the dummy. MarkedTomato 810 — 2y

1 answer

Log in to vote
0
Answered by
2Loos 168
2 years ago
Edited 2 years ago

Why don't you just use CFrame?

local dummy = workspace.Dummy
local dummy2 = workspace.Dummy2
local dummyhum = dummy.HumanoidRootPart --You can't move a Humanoid. Only RootPart.

dummyhum.CFrame = dummy2.HumanoidRootPart.CFrame

Always remember, when moving a player or a rig, move the HumanoidRootPart, never the Humanoid itself. Humanoid is only for player / rig Properties.

Also remember to simplify your techniques. Roblox Characters already have attachments inside of them, so you can just use CFrame to move them about. CFrame(s) work better in situations requiring characters.

Here's an alternate script that explains what I commented, below.

local dummy = workspace.Dummy
local dummy2 = workspace.Dummy2
local dummyhum = dummy.PrimaryPart

dummyhum.CFrame = dummy2.PrimaryPart.CFrame
0
In the case of the dummyhum variable, you could also substitute PrimaryPart for HumanoidRootPart. By default, a Roblox character's PrimaryPart is the HumanoidRootPart. 2Loos 168 — 2y
Ad

Answer this question