Need help with :Moveto()

I need help with a very simple script that I have that is about :Moveto() that I also copied from the wiki.

The Script
local dummy = game.Workspace:WaitForChild("Dummy")
local human = dummy.Humanoid

local GreenFlag = game.Workspace.GreenFlag

human:MoveTo(GreenFlag.PrimaryPart.Position)

When I test this code to see if the Dummy would go to the GreenFlag I get this error in the output:

errororo

So why is it not working if it’s from the wiki? am i missing something?

1 Like

Did you set the PrimaryPart of GreenFlag?

2 Likes

What am I supposed to set the PrimaryPart of the GreenFlag to?

And why wouldn’t it work if the GreenFlag doesn’t have a PrimaryPart?
This is confusing.

The PrimaryPart is a BasePart (think parts, meshes, unions) that models use as a reference for rotating and moving. The reason that PrimaryPart should be set is because you are using GreenFlag.PrimaryPart.Position!

2 Likes

So if I set the PrimaryPart of the GreenFlag model to any of the parts inside it the Dummy would move to the part that is set to the PrimaryPart?

Yes, the dummy would move to that part.

2 Likes

Thank you so much!

The script now works and the Dummy moves to the PrimaryPart you explained this very well!

I don’t know how I missed something so small like this 681766487492657153