For some reason I keep getting an error saying “Humanoid of Character needs to be a descendant of the game object” whenever I try to preload my animations. The weird thing is I wait for Character, and I wait for the Humanoid inside of the character to load. Why isn’t this working properly?
local Player = Folder.Parent.Parent
local Character = Player.Character or Player.CharacterAdded:Wait()
local hit1 = script:WaitForChild("Hit1")
local hit2 = script:WaitForChild("Hit2")
local hit3 = script:WaitForChild("Hit3")
local hit4 = script:WaitForChild("Hit4")
local hit5 = script:WaitForChild("Hit5")
local Humanoid = Character:WaitForChild("Humanoid")
if Humanoid then
for _,v in pairs(script:GetChildren()) do
if v:IsA("Animation") then
Humanoid:LoadAnimation(v)
end
end
end