Idea: I've made a tool in Roblox studio with an animation whenever you equip the tool. If you suddenly equip the tool it'll play the animation of you bringing it up.
Problem: If you equip the tool and suddenly unequip the tool while the animation is playing, the animation will just kinda be still.
example: https://streamable.com/k8824p
The beginning is what happens when you play through the whole animation, this part is fine, as it goes to where it needs to go. The last part is what the problem is, you can see that I equip the tool and then immediately unequip it. This makes the next animation play for some reason.
I've highlighted the important parts(Which parts make the tool's animation play)
Script:
wait(1)
local Player = game.Players.LocalPlayer
local dance = Player.Character.Humanoid:LoadAnimation(script.Parent.Animation) -- the holding animation
local Action = Player.Character.Humanoid:LoadAnimation(script.Parent.ACtion)
local Speed= 28
local DefaultSpeed= 16
local Fork = Player.PlayerGui:WaitForChild("ScreenGui").TrustyFork
local Hands = Player.PlayerGui:WaitForChild("ScreenGui").Hands
local Grunt = game.Workspace.ClimbGrunt
local BringUp = Player.Character.Humanoid:LoadAnimation(script.Parent.Bringup) -- Bringing up Animation Variable
local Tool = script.Parent
Tool.Equipped:Connect(function()
BringUp:Play() -- Brings the tool up to your view
wait(.5) -- how long the animation takes
dance:Play() -- Holds the tool still
Player.Character.Humanoid.WalkSpeed = Speed
Fork.Visible = true -- Visible Part
Hands.Visible = false -- Visible Part
end)
Tool.Unequipped:Connect(function()
BringUp:Stop() -- Should stop the bringing up animation
dance:Stop() -- Should stop the holding animation
Player.Character.Humanoid.WalkSpeed = DefaultSpeed
Hands.Visible = true -- Visible Part
Fork.Visible = false -- Visible Part
end)
Tool.Activated:Connect(function()
Action:Play()
Grunt:Play()
wait(1)
dance:Play()
end)

1 comment
On line 16 wait 5 seconds it might take it away after the 5 seconds