So I basically made an NPC that ‘imitates player’ but this keeps happening:
Before we continue, NO I did not add pathfind to the NPC. (It’s very laggy if I do it specifically to him) He basically stopped at a certain distance THEN attacks, and I want to force players to use covers for this ‘Boss fight’
Here is an example of what I mean from one of my games:
local function canSeeTarget(target)
local origin = boss.HumanoidRootPart.Position
local direction = (target.HumanoidRootPart.Position - boss.HumanoidRootPart.Position).unit * 40
local ray = Ray.new(origin, direction)
local hit, pos = workspace:FindPartOnRay(ray, boss)
if hit then
if hit:IsDescendantOf(target) then
return true
end
else
return false
end
end
Edit: you need to have a boss variable for the model of the npc
ok. I know how to do that. But how would you make it so that he moves around the corner and find the player. This is mainly about the npc finding his way to the player.