So I have a Animate localscript in Startercharacterscripts with some custom animations, and I have a tool/ability that changes your animations. I made 2 folders in ReplicatedStorage that each have 1 animate script, 1 which has the original one (the one in startercharacterscripts), and the other which has different animations which the tool uses. When I activate the tool the animations work fine, but when I disable the tool the animations don't change back, please help! heres the server script inside the tool:
001 | local Tool = script.Parent |
002 | local Cooldown = false |
003 | local CDTime = 6 |
004 | local HPBuff = 50 |
005 | local WalkSpeedBuff = 15 |
006 |
007 | Tool.OpenEvent.OnServerEvent:Connect( function (plr) |
008 | if Cooldown then return end |
009 |
010 | spawn( function () |
011 | plr.Character:FindFirstChild( "Pants" ):Destroy() |
012 | plr.Character:FindFirstChild( "Shirt" ):Destroy() |
013 | Cooldown = true |
014 | wait(CDTime) |
015 | Cooldown = false |
They don't change back because you destroyed the original animation.
1 | plr.Character.Animate:Destroy() |
You should instead just clone the original animation script to somewhere in your character (not directly in it, I'd say a folder or something).
And then you can run a unequipped connection to give the original animations back to your character with:
1 | plr.Character [ "Some Folder" ] .Animate.Parent = plr.Character |
You can then destroy the other animations other than the original one inside the unequipped connection.