Hi, My non-humanoid Npc pauses at a waypoint each time it reaches it. Is there a way to fix this?
Code:
for i,v in pairs(waypoints) do
if i ~= 1 then
local distance = (waypoints[i - 1].Position - v.Position).Magnitude
local tweenInfo = TweenInfo.new(distance/self.walkspeed)
self.Npc.PrimaryPart.CFrame = CFrame.lookAt(self.Npc.PrimaryPart.Position,Vector3.new(v.Position.X,self.Npc.PrimaryPart.Position.Y,v.Position.Z))
tween = TweenService:Create(self.Npc.PrimaryPart,tweenInfo,{Position = v.Position + Vector3.new(0,self.Npc.PrimaryPart.Size.Y/2)})
tween:Play()
tween.Completed:Wait()
end
end
1 Like
What do you mean by this? If you only put one waypoint for the npc to go to, it will pause when finished walking to that waypoint.
Try using @GrayzcaIe’s Simple Path module.
This is using pathfinding service; when it reaches a waypoint it pauses for a little bit. It might be hard to see because of the laggy video, but there are multiple waypoints.
Oh, the video was too short to see the npc walking to the other waypoint.
2 Likes
No, that was multiple waypoints. The video is a little laggy so it’s hard to see the pauses. Sorry lol
use
repeat tween:Play()
until tween.Completed:Wait()
Could you show your entire code? The only thing you showed was the loop for the waypoints.