Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

any idea why my idle animation doesnt go back to the original one?

Asked by 4 years ago

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:

local Tool = script.Parent
local Cooldown = false
local CDTime = 6 
local HPBuff = 50
local WalkSpeedBuff = 15 

Tool.OpenEvent.OnServerEvent:Connect(function(plr)
if Cooldown then return end 

spawn(function()
    plr.Character:FindFirstChild("Pants"):Destroy()
    plr.Character:FindFirstChild("Shirt"):Destroy() 
    Cooldown = true
    wait(CDTime)
    Cooldown = false 
end)

plr.Character.Humanoid.WalkSpeed = plr.Character.Humanoid.WalkSpeed + WalkSpeedBuff

local pants = Instance.new('Pants', plr.Character)
pants.Name = 'Pants'
local shirt = Instance.new('Shirt', plr.Character)
shirt.Name = 'Shirt'
shirt.ShirtTemplate = "rbxassetid://2382909"
pants.PantsTemplate = "rbxassetid://272224987"  
plr.Character["Body Colors"].HeadColor = BrickColor.new("Crimson")  

Tool.Sound:Play()
local Tail = game.ReplicatedStorage.CloakTails.FourTail:Clone()
Tail.Anchored = false 
Tail.CanCollide = false 
Tail.Parent = plr.Character
local Weld = Instance.new("Weld",Tail)
Weld.Part0 = plr.Character.LowerTorso
Weld.C0 = CFrame.new(0.09, 0, 2.69) * CFrame.fromEulerAnglesXYZ(0,179,0) 
Weld.Part1 = Tail   
_G.OriginalEyesTexture = plr.Character.Head.face.Texture
plr.Character.Head.face:Destroy()   
local Eyes = Instance.new("Decal")
Eyes.Texture = "rbxassetid://5719197948"
Eyes.Name = "face"
Eyes.Parent = plr.Character.Head
local CloakAnimation = game.ReplicatedStorage.CloakTails.CloakAnimate.Animate
plr.Character.Animate:Destroy()
CloakAnimation:Clone()
CloakAnimation.Parent = plr.Character       
plr.Character.Humanoid.MaxHealth = plr.Character.Humanoid.MaxHealth + HPBuff 
plr.Character.Humanoid.Health = plr.Character.Humanoid.Health + HPBuff
local Aura1 = game.ReplicatedStorage.JinCloakOneTailParticle:Clone()
Aura1.Parent = plr.Character.HumanoidRootPart
local Aura3 = game.ReplicatedStorage.JinCloakOneTailParticle:Clone()
Aura3.Parent = plr.Character.Head
local Aura5 = game.ReplicatedStorage.JinCloakOneTailParticle:Clone()
Aura5.Parent = plr.Character["Right Arm"]
local Aura7 = game.ReplicatedStorage.JinCloakOneTailParticle:Clone()
Aura7.Parent = plr.Character["Left Arm"]
local Aura9 = game.ReplicatedStorage.JinCloakOneTailParticle:Clone()
Aura9.Parent = plr.Character["Left Leg"]
local Aura11 = game.ReplicatedStorage.JinCloakOneTailParticle:Clone()
Aura11.Parent = plr.Character["Right Leg"]

end)

Tool.CloseEvent.OnServerEvent:Connect(function(plr)

plr.Character:FindFirstChild("FourTail"):Destroy()

plr.Character.Humanoid.MaxHealth = plr.Character.Humanoid.MaxHealth - HPBuff 
plr.Character.Humanoid.Health = plr.Character.Humanoid.Health - HPBuff
plr.Character.Humanoid.WalkSpeed = plr.Character.Humanoid.WalkSpeed - WalkSpeedBuff

plr.Character:FindFirstChild("Pants"):Destroy()
plr.Character:FindFirstChild("Shirt"):Destroy()
plr.Character.Head.face:Destroy()   

local pants = Instance.new('Pants', plr.Character)
pants.Name = 'Pants'
local shirt = Instance.new('Shirt', plr.Character)
shirt.Name = 'Shirt'
shirt.ShirtTemplate = "rbxassetid://413009924"
pants.PantsTemplate = "rbxassetid://769453213"

local Eyes = Instance.new("Decal")
Eyes.Texture = "rbxassetid://5124465323"
Eyes.Name = "face"
Eyes.Parent = plr.Character.Head

plr.Character["Body Colors"].HeadColor = BrickColor.new ("Light orange")    

local NormalAnimation = game.ReplicatedStorage.CloakTails.NormalAnimate.Animate
plr.Character.Animate:Destroy() 

NormalAnimation:Clone() 
NormalAnimation.Parent = plr.Character      
plr.Character.HumanoidRootPart.JinCloakOneTailParticle:Destroy()
plr.Character.Head.JinCloakOneTailParticle:Destroy()
plr.Character["Right Arm"].JinCloakOneTailParticle:Destroy()
plr.Character["Left Arm"].JinCloakOneTailParticle:Destroy()
plr.Character["Left Leg"].JinCloakOneTailParticle:Destroy()
plr.Character["Right Leg"].JinCloakOneTailParticle:Destroy()    

end)

1 answer

Log in to vote
0
Answered by
WBlair 35
4 years ago

They don't change back because you destroyed the original animation.

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:

plr.Character["Some Folder"].Animate.Parent = plr.Character

You can then destroy the other animations other than the original one inside the unequipped connection.

0
Ok, I will try this Sabertooth11123 38 — 4y
Ad

Answer this question