Hello, I am trying to fix these very annoying bugs with my script
Here is the location of the anim
Part of the script that errors:
function AI.new(NPC,WalkAnim,AttackType,idleAnim)
CollectionService:AddTag(NPC,NPC.Name)
CollectionService:GetInstanceAddedSignal(NPC.Name):Connect(function(NPC)
local Team = NPC.Parent.Name
local NPCProperties = setmetatable({},AI)
local hum = NPC.Humanoid
local humrp = NPC.HumanoidRootPart
local WalkAnim = hum:LoadAnimation(WalkAnim)
local RunOnce = false
local MeleeDB = false
local NPCHitbox = nil
if idleAnim then
idleAnim = hum:LoadAnimation(idleAnim)
NPCProperties.IdleAnim = idleAnim
idleAnim:Play()
end
NPC.PrimaryPart:SetNetworkOwner(nil)
I’ve tried many things to fix it, like a :WaitForChild(‘Humanoid’) and doing a pcall aswell as a repeating for loop as a way to brute force it to work.
ps: I have multiple AI units using this script, and that is why there is an if statement for detecting if the idleanim is a thing, as some ai don’t have one.
