I’ve tried everything and I cant seem to figure it out how to stop an animation that was loaded into the humanoid using a script separate from the script that loaded the anim
local anim = script.Parent.Systems.UpperCut
anim:Stop()
local animation = Humanoid.Animator:WaitForChild("UpperCut")
animation:Stop()
local animation = "UpperCut"
Humanoid.Animator:StopAnimation(animation)
These are snippets I’ve tried so far^
Apparently no one i know has ever needed to stop a specific loaded anim literally any insight would help cheers.
I’m not sure I understand. When you load an animation, that doesn’t mean you’re playing the animation. In my experience, when I load an animation via Animator, I keep a reference to the AnimationTrack that gets returned. I can use that to start and stop the animation as I like.
If you didn’t keep a reference to the AnimationTrack, you can still get a list of the playing animation tracks via Animator:GetPlayingAnimationTracks(). Within that list you can look for the animation track you want to stop.
If there isn’t a better way to do this, I would call a bindable Event on the script you want to stop the animation on to message the script that has a reference to the animationTrack that’s playing in order to stop it there the normal method.
You would loop through all the animation tracks on the animator to stop the animation with its name.
So for your use case, it would be
for i, track in animator:GetPlayingAnimationTracks() do
if track.Name == "UpperCut" then
track:Stop()
break
end
end
Here’s an example of it being used.
task.wait(0.5)
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local Emote = Instance.new("Animation")
Emote.Name = "Shuffle"
Emote.AnimationId = "rbxassetid://10714068222" -- Public Emote Used
animator:LoadAnimation(Emote):Play()
task.wait(3)
for i, track in animator:GetPlayingAnimationTracks() do
if track.Name == "Shuffle" then
track:Stop()
break
end
end