In a project I’m working on, I have a tool. I’d like the game to play a short unequipping animation before the tool fully unequips, and then have the tool unequip. However, I have no idea on how I would go about doing this.
There’s probably a simple way I’m not thinking of, but if anyone knows how I could achieve this, then please let me know!
local function PlayAnim(Anim, Humanoid)
-- Assuming you've defined the humanoid
local Animation = Humanoid.Animator:LoadAnimation(Anim)
Animation:Play()
Animation.Stopped:Wait()
return true
end
-- Unequip
repeat wait() until PlayAnim(AnimationHere, Humanoid)
Humanoid:UnequipTools()
The thing is, I’d like to have this fire when the tool unequips.
Sure, I could have this fire when tool.unequipped, but this means the tool disappears from your hand, and also if you try and unequip one tool and equip another, then the other tool’s equip code runs at the same time, and conflicts with a lot of things.
The only thing I can think of to prevent a player from interfering is to basically create your own inventory system. But that takes a while.
1 Like