Animations Are Combined

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want my animations to play one at a time

  2. What is the issue? if i activate another animation before the first one is finished they both play at the same time

  3. What solutions have you tried so far?
    I tried changing the animation priority and I tried stopping the animation before playing another one using the Stop() Command

Here is a video showing the issue:robloxapp-20210801-2009399.wmv (411.6 KB)

I dont know if it is the animation or the script
my friend made the animation

Here is the script:

script.Parent.MouseButton1Click:Connect(function()
local player = game:GetService(“Players”).LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local characterModel = workspace:FindFirstChild(character.Name… " Clone")
– Cloning the players avatar

characterModel.Animation.AnimationId = "rbxassetid://7183502456"
-- I already added an animation instance in the clone
local sad =	characterModel.Humanoid:LoadAnimation(characterModel.Animation)
sad.Looped = false
sad.Priority = Enum.AnimationPriority.Action
sad:Play()

end)

The only thing different about each script is the animation id and local names.

Oh I have a solution to this:

local PlayingAnimations = CharacterModel.Humanoid:GetPlayingAnimationTracks() -- gets the playing animation tracks

script.Parent.MouseButton1Click:Connect(function()
for _, v in pairs(PlayingAnimations) do -- loops over the returned table of playing animations
v:Stop() -- calls the stop function on them
sad:Play() -- plays your animation
   end
end)
1 Like

There are three things which I think can be of help to you.

  1. AnimationTrack:AdjustWeight

  2. AnimationTrack.Stopped:Connect(function()

  3. Iterate through character humanoid:

Example:

for i, v in pairs (humanoid:GetPlayingAnimationTracks()) do
if v.Name == “name” then
v:Stop()
end

Hope this helps you!

1 Like