I want to run a callback function upon the animation stopping.
The .Stopped event doesn’t work, I have tried using AnimationTrack.Stopped:Wait() and AnimationTrack.Stopped:Connect(function().
-- Framework Class
function Framework:Reload()
if Disabled then return end
if not CurrentModule then return end
--//
local Data = CurrentModule:GetData()
local Ammo = Data.Ammo.Primary
--// Animation
if Ammo <= 0 then
ViewmodelPlugin:PlayAnimation("Reload", ReloadingPlugin:ReloadNormal(Data))
else
ViewmodelPlugin:PlayAnimation("ReloadEmpty", ReloadingPlugin:ReloadNormal(Data))
end
end
--Viewmodel Class
function Viewmodel:PlayAnimation(Name, Callback)
Animations[Name]:Play()
if Callback then
Animations[Name].Stopped:Connect(function()
print("Stopped!")
end)
end
end
No clue why this is not working.