Animator is not a valid member of Humanoid

Hello, i’ve been lately wanting to make a taser. But when the taser hits a non-player character, it says "Animator is not a valid member of Humanoid “Workspace.Dummy.Humanoid”

Is Humanoid.Animator only local?

if workspace.Dummy.Humanoid:FindFirstChildOfClass("Animator") then
    -- animator exists, do stuff
end

This checks if the animator exists, if it does, then it’ll run the specific code.

This article on the Devhub should help.

1 Like

now it doesn’t even animate. Im using raycasting to find the hit player, here’s a the part of the script:

StunnedTrack = result.Instance.Parent:FindFirstChild(“Humanoid”).Animator:LoadAnimation(StunnedAnim)
StunnedTrack.Priority = Enum.AnimationPriority.Movement
StunnedTrack:Play()

robloxapp-20210814-1929216.wmv (1.2 MB)

AFAIK:

NPC’s do not have animator created unlike actual characters, so you’ll have to create an animator inside the NPC…

Using Animations | Roblox Creator Documentation <= Non-Humanoid Characters

(Not exactly sure though, just assuming…)

EDIT:

Try WaitForChild on Animator, didn’t realise you aren’t doing that!

2 Likes