I am making a Camping inspired game, and tried to make a NPC names explorer move. When I run the game the NPC just randomly walks in the opposite direction I want it to, instead of the Point1 and Point2 system I have setup. Any ideas?
local NPC = game.Workspace.Explorer
debounce = true
wait(2)
NPC.Humanoid:Move(game.Workspace.Point1.Position)
NPC.Humanoid.MoveToFinished:Wait(5)
wait(5)
NPC.Humanoid:MoveTo(game.Workspace.Point2.Position)
NPC.Humanoid.MoveToFinished:Wait(5)
wait(5)
end
local NPC = game.Workspace.Explorer
debounce = true
wait(2)
NPC.Humanoid:MoveTo(game.Workspace.Point1.Position)
NPC.Humanoid.MoveToFinished:Wait()
wait(5)
NPC.Humanoid:MoveTo(game.Workspace.Point2.Position)
NPC.Humanoid.MoveToFinished:Wait()
wait(5)
end
When using .MoveToFinished:Wait(), the numbers in the parenthesis do nothing. The added :Wait() means that your code is yielding until the NPC finishes moving.
I watched a tutorial on how to make a game similar to camping for scripts etc, and he said to script the pathfinding, I did the script and it did not work. I adjusted it it did not work.
I tried doing what you suggested, still broken. Thanks for your time however,
Path Finding is using the path finding service, this is just using the moveTo function. Also when you typed in Move To instead of move, it still moved in the opposite direction?
Lol, yeah the reason why it messed up was because there was an “end” in the bottom of the script, it didn’t have anything to end, so it was just floating in there and caused an error. Now that you typed while true do, it had something to end, and didn’t throw an error. But the “Move” instead of “MoveTo” was also definitely an error.