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

How do I make a NPC move in a straight line and disappear?

So, I am trying to make an NPC walk from one place to another then disappear then randomly spawn another in, for the walk script I am using the following code:

local NPC = game.Workspace.Test -- (Change "Test" to your NPC name)

while true do
	wait(1) -- (Change the number to how long you want your npc to stop)
	NPC.Humanoid:MoveTo(game.Workspace.Point1.Position)
	NPC.Humanoid.MoveToFinished:Wait()

	 change "Point1" in the script into the name of your part.
	copy this:

	wait(1)
	NPC.Humanoid:MoveTo(game.Workspace.Point1.Position)
	NPC.Humanoid.MoveToFinished:Wait()
end

However, Roblox is saying a few error messages And I am unsure on how to make the NPC disappear and regenerate a new avatar. Does anybody have any answers?

3 comments

0

tell us the errors shown plus u should prolly use ur own code cuz this doesnt look like its urs

0

In addition, I would also like them to stop at a certain time, so when it signals a light then they will stop moving or something.

0

It is not my own code I am using it from a model that I found an edited, my errors say "incomplete statement" and expected assignment or a function call

1 answer

I think it is because you have to delete the part where it says: "Change "Point1" in the script... try to delete that part because the script thinks you want to make a in pairs loop because of the "in". Hope this helps.

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