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

MoveTo does't work properly?

I'm trying to get an NPC to move to a random block inside a model. Here's the code:

local base = game.Workspace.Base

target = base:FindFirstChild("building")
script.Parent.Humanoid:MoveTo(Vector3.new(target.Position))

The NPC, instead of moving to one of the blocks, moves to the center of the baseplate instead. Any Idea why?

1 answer

✓ Accepted answer

You're calling Vector3.new on an object that is already a Vector3. Doing this resets it to 0,0,0.

script.Parent.Humanoid:MoveTo(target.Position)

2 comments

0

this is a good answer :)

0

Ohhhh, Thanks!!

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