Basically I need to to have this npc walk from the starting point, all the way to the end point, but if there are humanoids with the name lets say 'eat', the NPC will stop, do its damage attacks until its dead/gone, and then continue on to the ending point, and once reached the end point walk over to the secondary end point. https://gyazo.com/892e94dec2df22495500db1774d35f16 Not exactly sure how I would go about this, help is very much appreciated. Also, there will be multiple rows, not just the one, and I only want the NPC to attack the humanoids on the row that its walking on.
First off, to move the actual npc, you could use Humanoid:MoveTo()
.
local Destination = "The Position of the NPC's destination" --Remove the quotes Humanoid:MoveTo(Destination)
To kill anything that touches it while it's walking, you could use the .Touched
event.
HumanoidRootPart.Touched:Connect(function(obj) if obj.Parent then if obj.Parent:FindFirstChild("Humanoid") then obj.Parent.Humanoid.Health = 0 end end end)
or you could use ray casting for something that doesn't touch the object. I'll provide help with ray casting if you need it. Just reply to this if you need help with it because ray casting requires a lot more coding.