What do I need to wait for to preload animations?

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

Error: 16:05:06.270 - LoadAnimation requires the Humanoid object (Dracolyx.Humanoid) to be a descendant of the game object

The error happens because the player’s character is nil, so it’s a descendant of the workspace yet, hence why the error occurs. You can use this one-liner here before you call LoadAnimation (put it above the for loop):

while (not Character.Parent) do Character.AncestryChanged:Wait() end

This waits until the Character’s Parent has changed, where it is parented to the workspace