when animating the enemies in a tower defense game this error shows up:
Attempt to connect failed: Passed value is not a function
when i hover over it, no script or line shows up however i assume the error is because of this script as it started showing up when i made this script:
local function animateMob(object)
local humanoid = object:WaitForChild("Humanoid")
local animationsFolder = object:WaitForChild("Animations")
if humanoid and animationsFolder then
local walkAnimation = animationsFolder:WaitForChild("Walk")
if walkAnimation then
local animator = humanoid:FindFirstChild("Animator") or Instance.new("Animator", humanoid)
local walkTrack = animator:LoadAnimation(walkAnimation)
walkTrack:Play()
end
else
warn("No humanoid/animation folder for", object.Name)
end
end
workspace.Mobs.ChildAdded:Connect()
keep in mind this is a local script.