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)
