WaitForChild() Warning in strict mode

Hey all. Trying to write code in strict mode - all good except for this section:

humanoid = character_:WaitForChild("Humanoid") -- thinks this returns an Instance!
humanoidrootpart = character_:WaitForChild("HumanoidRootPart") -- thinks this returns an Instance!

I am getting a warning here. I get it, but how could I tell it that this will always return a Humanoid object and a Part object respectively?

1 Like

Does setting the type directly help?

humanoid: Humanoid = (character_:WaitForChild("Humanoid")::Humanoid)
humanoidrootpart: Part = (character_:WaitForChild("HumanoidRootPart")::Part) -- thinks this returns an Instance!
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.