So right now im working on an animation system which freezes the player while the animation plays, however if the player switches tool while the animation is playing Track.Stopped does not fire , so how would I modify this code to make ‘1’ print when ither a. the animation finishes, b. the tool is unequipped
I think you need to have a tool.equiped function to set a flag then use that flag inside this module.
I have always used a sort of hacky method to do this.
local condition = false local conn, conn2 conn = Track.Stopped:Connect(function() conn:Disconnect() conn2:Disconnect() condition = true end) conn = Tool.Unequipped:Connect(function() conn:Disconnect() conn2:Disconnect() condition = true end) repeat wait() until condition
eh, I knew I could do this, I was just wondering if there was a simpler more memory efficient way
It’s quite easy with BindableEvents if used as the following: