I am trying to make it so that when the NPC is touched once by a humanoid it won't check for being touched anymore, But when test this the NPC continues to follow the humanoid.Touched function even though it should not.
local pathdeterminer
local npc = script.Parent
local humanoid = npc:WaitForChild("Humanoid")
local inbattle = false
local enemyarea = game.Workspace.BattleCircle:WaitForChild("Enemies")
if inbattle == false then
humanoid.Touched:Connect(function(hit)
local check = hit.Parent:WaitForChild("Humanoid")
if check ~= nil then
inbattle = true
npc.Torso.CFrame = enemyarea:WaitForChild("E1").CFrame + Vector3.new(0,3,0)
end
end)
end
