I was experimenting with NPCs recently but my NPC won’t move when testing.
I thought it was something in the script so I tried to change some things, but it still wouldn’t work. I used print(“text”) to see if the script was running and it was. I’m at a loss now in what to do, so I came to the forum.
My hierarchy:
my script:
my output:
It all seems to check out, but my NPC still isn’t moving
1 Like
Look for any errors in the script and any reason for why this would fail, do you have a point a or b? Just look for any logical mistake you made?
my point a and b are 2 blocks named Goal and Block, I correctly referenced them in the function.
When your NPC reaches the goal position it stops moving because you keep telling it to move to the same position. If you want it to move in a loop to Goal and then to Block again, modify the if statement at line 26:
if nextDestinationObject == pointA then
nextDestinationObject = pointB
else
nextDestinationObject = pointA
end
2 Likes
Make sure your Humanoid’s Walkspeed is above 0.
I believe MoveToFinished fires after 8 seconds regardless of reaching the point or not.
The MoveToFinished event returns a boolean, true or false relating to these 8 seconds.
Maybe try store MoveToFinished:Wait() in a variable and print it off.
Are any of your parts anchored on the npc?
1 Like
@mishajones Thanks for the advice, but I don’t want the npc to move back to Goal.
@InedibleGames I haven’t tried the walk speed yet.
@Instance0new I already checked and everything is unanchored. I’ll attach a video of my problem
Video of script running and NPC not walking:
I checked walk speed on the humanoid and it is set to 16, I even tried the WalkTo Point and it still didn’t work
Does the NPC contain a jointed child BasePart named “Torso”? Since the humanoid is R6 (I assume) it wouldn’t be treated as a valid humanoid and moveTo wouldn’t work.
2 Likes
Try adding
guide.HumanoidRootPart.Anchored = false
5 Likes