Why am I getting Infinite yield for Humanoid on a simple Variable script?

  1. What do you want to achieve? Being able to find humanoid?

  2. What is the issue?


    and I am getting this error -

  3. What solutions have you tried so far? I’ve looked everywhere. (I think)
    Im just trying to make a animation script if you hold out a tool so if you have any links to a tutorial or script thanks

local tool = script.Parent
local Walk = script:WaitForChild("Walk")
local Walk = script:WaitForChild("Idle")

local Character = tool.Parent.Parent
local Humanoid = Character:WaitForChild("Humanoid")

Ignore the Double walk Variable I accidentally did that it, ive already changed it, That wasnt anything to do with it

this is on a local script right?

Yes it is I tried normal script and local

try tool.Parent.Parent.Character.Humanoid

the tools Parent is only a Character when the tool is equipped

local tool = script.Parent
local Walk = script:WaitForChild("Walk")
local Walk = script:WaitForChild("Idle")

local Character
local Humanoid

tool.Equipped:Connect(function()
Character = tool.Parent.Parent
    Humanoid = Character:WaitForChild("Humanoid")
end)

I get the error attempt to index nil with WaitForChild with this.

It worked, Im stupid, Thanks very much :smiley: