ok this error has been coming up for soo long:
LoadAnimation requires the Humanoid object (DragonSpawner12.Humanoid) to be a descendant of the game object
Here is my code:
local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:Wait() local humanoid = char:WaitForChild("Humanoid") local anim = Instance.new("Animation") anim.AnimationId = "rbxassetid://5595931188" local animation = humanoid:LoadAnimation(anim)
I HAVE SEEN SO MANY ARTICLES NOT SOLVING THIS!
PLEASE Help me!
Edit: thanks for the inspiring comments
From the looks of it, this runs on a LocalScript
, so it most likely loads much before the character. The code should work modified like this:
local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:Wait() local humanoid = char:WaitForChild("Humanoid") local anim = Instance.new("Animation") anim.AnimationId = "rbxassetid://5595931188" player.CharacterAdded:Connect(function() local animation = humanoid:LoadAnimation(anim) end)