I’m writing a gun wielding script, in which if you equip the tool, it would draw the gun off your hip. Thing is, I do not know how to yield the backpack until my drawing animation is over, which is to avoid clustering the script by equipping and unequipping the tool while the animation is running.
Any ideas on how could I make this?
In context:
The tool mustn’t be able to be unequipped or equipped again until the animation is over (imagine it’s going to draw the gun)
I don’t know if there is a proper way to do it, but here is a somewhat hacky way. First, assuming each tool has a script inside it, whenever the .Equipped event has fired, Humanoid:UnequipTools() to temporarily
unequip the tool. Then, play the animation and since the AnimationTrack object, which is what :LoadAnimation() returns, has a .Length property which describes how many seconds the animation lasts, you can simply wait(Length) the length of the animation, and after the waiting is done, re-Humanoid:EquipTool(the tool).