I'm trying to make NPCS move to a block when an event is fired
The NPCS move between 4 blocks and I'm trying to make it so the NPCS start going to a different block when I fire the event, but it doesn't do anything, no errors.
game:GetService("ReplicatedStorage").Events.Run.OnServerEvent:Connect(function()
local npcs = game.Workspace.NPCS:GetChildren()
for i, v in pairs(npcs) do
local anim = script.Animation
local humanoids = v.Humanoid
humanoids.Animator:Destroy()
wait(0.25)
local theanim = humanoids:LoadAnimation(anim)
theanim:Play()
humanoids.Parent.Script.Disabled = false
humanoids:MoveTo(game.Workspace.Path.RunTo.Part1)
humanoids.MoveToFinished:Wait()
end
end)
This is the script inside the NPC, I tried disabling it as you can see in my other script
local hum = script.Parent:WaitForChild("Humanoid")
local anim = script:WaitForChild("Animation")
local move = script.Parent.Humanoid:LoadAnimation(anim)
script.Parent.Humanoid.WalkSpeed = 10
if script.Parent ~= nil then
move:Play()
end
while wait(0.25) do
script.Parent.Humanoid:MoveTo(game.Workspace.Path.Part3.Position)
script.Parent.Humanoid.MoveToFinished:Wait()
script.Parent.Humanoid:MoveTo(game.Workspace.Path.Part1.Position)
script.Parent.Humanoid.MoveToFinished:Wait()
script.Parent.Humanoid:MoveTo(game.Workspace.Path.Part4.Position)
script.Parent.Humanoid.MoveToFinished:Wait()
script.Parent.Humanoid:MoveTo(game.Workspace.Path.Part2.Position)
end
