I am trying to delete the animation at the end when it gets stopped, but I am having trouble with that, I've tried
Instance:Remove
with a few variations but each has fed me an error.
local player = game.Players.LocalPlayer local Character = player.Character or player.CharacterAdded:Wait() local Humanoid = Character:WaitForChild("Humanoid") local Script = Character:WaitForChild("Animate") local debounce = false script.Parent.MouseButton1Click:Connect(function(clicked) if not debounce then debounce = true player.Character.Animate.Disabled = true local Animation = Instance.new("Animation") Animation.AnimationId = "rbxassetid://5035220879" Animation.Parent = player.Character Animate = Humanoid:LoadAnimation(Animation) Animate:Play() else Animate:Stop() debounce = false player.Character.Animate.Disabled = false end end)
I'm sure you can just do
Animate:Destroy()
whenever you need to, to get rid of the Animation when it's over. Not sure why :Stop() isn't enough for that but whatever you gotta do, you gotta do.