Yeah thats pretty much all i need to know at this point
He should have it so that all the ai’s be controlled by one main script that spawns/despawns/ manage attacks for the ai so you dont need to run so many loops per ai
good idea. Ill test if my script works and if it do i might do this thanks.
Incase anyone else want this
Its a “Script” Not a localScript
local Run = game:GetService("RunService")
local AI = script.Parent
Run.Heartbeat:Connect(function()
for i, v in pairs(game.Players:GetChildren()) do
local char = v.Character or workspace:WaitForChild(v.Name)
local npcToCharacter = (char.Head.Position - AI.Head.Position).Unit
local AIlook = AI.Head.CFrame.LookVector
local dotProduct = npcToCharacter:Dot(AIlook)
if dotProduct > .5 then
print("play is in FOV")
else
print("play is not in FOV")
end
end
end)
Basicly checks if the Player is in the AI’s FOV
2 Likes
Heres a video of how the AI works currently The code for it is above
1 Like