Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

LoadAnimation requires the Humanoid object to be a descendant of the game object?

Hey there,

I've ran into this issue when a player dies/resets that causes the script to break showing an error.

Error Message:

LoadAnimation requires the Humanoid object (Aozwel.Humanoid) to be a descendant of the game object 

Script:

local input = game:GetService("UserInputService")
local rs = game:GetService("ReplicatedStorage")
local Mace = rs:WaitForChild("Mace")
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local human = char:WaitForChild("Humanoid")	
local idle = human.Animator:LoadAnimation(script.Parent:WaitForChild("Idle"))
local hurt = script.Parent.Hurt.Value
local wep = script.Parent
local cooldown = .85
local db = false
local equip = false
local swordsounds = script.Parent.Handle
local trail = script.Parent.Ball.Trail

	wep.Equipped:Connect(function(mouse)
	equip = true
	swordsounds.Out:Play()
	idle:Play()
	wep.Unequipped:Connect(function(mouse)
	equip = false 
	swordsounds.PutAway:Play()
	idle:Stop()
	end)

Thanks,

1 answer

well, error is explaining everything, you need to do

Humanoid:LoadAnimation() 

no

Humanoid.Animator:LoadAnimation()

because Animator isnt Humanoid

This discussion is preserved as it was. New answers, comments, and votes are closed.