Is there a more efficient method to get the animation length?

These lines of code work perfectly fine, however it just seems really “messy” and inefficient. I was wondering, if there is a more efficient method to do the same thing?

local LoadedAnim = Animator:LoadAnimation(Anim)
while LoadedAnim.Length == 0 do RunService.Heartbeat:Wait() end
Len = LoadedAnim.Length

You could use Instance:GetPropertyChangedSignal (see the code below).

local LoadedAnim = Animator:LoadAnimation(Anim)
LoadedAnim:GetPropertyChangedSignal("Length"):Wait()
local Len = LoadedAnim.Length

You could also use the content provider service to wait for the animation to load.