Hi.
So, I have a script that plays an animation when a player is dead. When the player is revived to full health, I want that player to stop its animation.
I programmed something like this, but the animation wont stop playing.
Here is the program. :
local Character = script.Parent
local Humanoid = Character.Humanoid
local Animation = Humanoid.Animator:LoadAnimation(script.Animation)
Humanoid.HealthChanged:Connect(function(Health)
if Health == 0 and not Animation.IsPlaying then
Animation:Play()
Animation:AdjustWeight(3)
script.Parent.HumanoidRootPart.Anchored = true
end
end)
Humanoid.HealthChanged:Connect(function(Health)
if Health > 99 and Animation.IsPlaying and script.Parent.HumanoidRootPart.Anchored == true then
script.Parent.HumanoidRootPart.Anchored = false
Animation:Stop()
end
end)
Here is a video example of what im talking about:
robloxapp-20221003-1424431.wmv (3.3 MB)
Help would be appreciated? Thank you.