So i have a script that makes an NPC walk to certain waypoints then destroy itself, here's the script:
-- Waypoint Folder and Parts
local Waypoints = game.Workspace.Map.Waypoints
local Way1 = Waypoints:WaitForChild('Waypoint1')
local Way2 = Waypoints:WaitForChild('Waypoint2')
local Way3 = Waypoints:WaitForChild('Waypoint3')
local Way4 = Waypoints:WaitForChild('Waypoint4')
local Way5 = Waypoints:WaitForChild('Waypoint5')
local Way6 = Waypoints:WaitForChild('Waypoint6')
-- Self
local Self = script.Parent.Parent
local hum = Self:WaitForChild('Humanoid')
local Walk = hum:LoadAnimation(Self:WaitForChild('Walk'))
-- Move the Humanoid; Args > HumanoidRootPart + Waypoint Part
local function MoveHumanoid(humanoid, waypoint)
humanoid:MoveTo(waypoint.Position)
humanoid.MoveToFinished:Wait()
end
-- Repeat Function For All Waypoints
Walk:Play()
MoveHumanoid(hum, Way1)
MoveHumanoid(hum, Way2)
MoveHumanoid(hum, Way3)
MoveHumanoid(hum, Way4)
MoveHumanoid(hum, Way5)
MoveHumanoid(hum, Way6)
-- Delete the Enemy
Self:Destroy()
I use this script in many different NPCs (a fast walking one and a normal speed one) and it works fine until I put this script in a slow walk speed NPC. It moves to the first couple waypoints semi-fine but when it reaches the 3rd waypoint it goes half way and skips straight to the 5th. Any help is appreciated thanks!
