Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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!

2 comments

0

Try using dummy.PrimaryPart instead of dummy.Humanoid

0

Make sure to unanchor all of the BaseParts inside the dummy.

1 answer

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

1 comment

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.