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

Moving my NPC won't work?

I have this loop, it gets the position of parts within a model and is supposed to move my NPC to those points, but it won't work. It doesn't throw any errors and I can't figure out why it doesn't work. The script is in the NPC

for i, v in pairs(game.Workspace.Movers:GetChildren())do
	script.Parent.Humanoid:MoveTo(v.Position)
end

2 answers

Your problem is simple, you need to move it with "v[i].Position". This will basically move the npc to a spot under v. Also, like PreciseLogic said, I suggest adding a while true do.

while wait(1) do --this will be a infinite loop that will wait 1 second before looping again
	for i, v in pairs(game.Workspace.Movers:GetChildren())do
	    script.Parent.Humanoid:MoveTo(v[i].Position)
	end
end

1 comment

0

Thx :D

Not sure if I'm correct. But you need something to trigger it. Try a while true do.

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