--[[
		Walking NPCs
All points (Point A, B, C, D, and E) must be inside of the model.
You should be able to edit the NPC's looks.
Simply keep the Humanoid, animate, Walk, Head, Torso, and (I think) the legs.
The NPC should  be grouped with the Points
]]
--


local npc = script.Parent

local idleanim = script.Animation1
local runanim = script.RunAnim

local idleanimtrack = npc.AI:LoadAnimation(idleanim)
local runanimtrack = npc.AI:LoadAnimation(runanim)

idleanimtrack:Play()
idleanimtrack.Looped = true
script.Parent.HitBox.Script.Enabled = false

model = script.Parent.Parent
hum = script.Parent.AI
torso = script.Parent.Torso
while true do
	wait(math.random(5,7))
	if model.PointA ~= nil then
		a = model.PointA
		hum:MoveTo(a.Position, a)
		idleanimtrack:Stop()
		script.Parent.Head["Scary Scream"]:Play()
		script.Parent.HitBox.Script.Enabled = true
		runanimtrack:Play()
		repeat
			wait(0.1)
			wait(6)
			script.Parent.Parent:Destroy()
		
		until (a.Position - torso.Position).magnitude <= 5

	else
		print("No Point A.")
	end

end
	
