Help: Why won't my animation play (Roblox is back)

Why won’t my animation play. I’m defining it, loading it, waiting for it to load, and I called it correctly.

local nameplate = script.Parent:WaitForChild("Name Plate")
local lv = script.Parent.LV
local EnemyName = script.Parent.EnemyName
local AI = script.Parent.AI.Value
local Anchor = script.Parent.Anchor.Value
local caught = false
local humanoid = script.Parent.Parent.Humanoid
local HopTrack = humanoid.AnimationController:LoadAnimation(humanoid.Hop)
repeat wait(0) until HopTrack.Length ~= 0
nameplate.TextLabel.Text = EnemyName.Value .. " Lv. " .. lv.Value
if AI == "Passive" then
	HopTrack.Looped = true
	HopTrack:Play()
	print(HopTrack.Length)
	while not caught do
		local distance = (Anchor.Position - script.Parent.Position).Magnitude
		if distance >= 10 then
			print("Far from home")
		end
		wait(0)
		print(HopTrack.TimePosition)
	end
end

Output:

  08:56:10.248  0.5333333611488342  -  Server - Script:14 --the length of the animation
  08:56:10.248  Far from home  -  Server - Script:18 --nothing important
  08:56:10.314  0  -  Server - Script:21 --the time of the animation

Its still broken

3 Likes

https://developer.roblox.com/en-us/api-reference/class/AnimationController

Why are you using an AnimationController when the NPC has a humanoid instance?

Thanks! The animation is now working!