-
What do you want to achieve? Keep it simple and clear!
I have a gui frame which has animations you can click to play, the animations are paused in the end state so you remain in the animation until it is stopped (by either clicking another animation or clicking “stop animation” -
What is the issue? Include screenshots / videos if possible!
Screenshot 1: After I click an animation, It does the animation and is paused at the end state. No issue.
Screenshot 2: After I click stop, as you can see it says “track stopped” like in the script itself but the character is still stuck in the animation
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried developer hub, viewed other forum posts and even asked this in a script help discord
StopAnimations doesn’t work, PlayAnimations works without an issue but I still posted it to give some insight about how the script works
local function PlayAnimation(player,buttonName)
local Animator = player.Character.Humanoid:FindFirstChildWhichIsA("Animator")
local animationId = animations[buttonName]
local anim = Instance.new("Animation")
anim.Parent = Animator
anim.Name = "PlayingAnimation"
anim.AnimationId = animationId
local track = Animator:LoadAnimation(anim)
track:Play()
track.Stopped:Connect(function()
track:Play(0, 1, 0)
track.TimePosition = track.Length - .000001
end)
active = true
print(active)
end
local function StopAnimation(player)
local Animator = player.Character.Humanoid:FindFirstChildWhichIsA("Animator")
for _, track in Animator:GetPlayingAnimationTracks() do
if track.Animation.Name == "PlayingAnimation" then
print(track.Animation.AnimationId)
track:Stop()
print("Track Stopped")
break
end
end
for _, anim in Animator:GetChildren() do
anim:Destroy()
end
active = nil
print(active)
end