local tool = script.Parent local player = game.Players.LocalPlayer local character = game.Players.LocalPlayer.Character or player.CharacterAdded:Wait() local animation local anim = script.Parent:WaitForChild("Animation"):Clone() tool.Equipped:Connect(function() animation =character:WaitForChild("Humanoid"):LoadAnimation(anime) character = character or tool.Parent or player.Character or player.CharacterAdded:Wait() if not animation then animation = character.Humanoid:LoadAnimation(animation) end end) script.Parent.Unequipped:Connect(function() animation:Stop() end)
I made a team change script that resets the character, then the animation of the tool is completely broken? how do I fix it?
When I reset this error shows up.
animation =character:WaitForChild("Humanoid"):LoadAnimation(anime)
typo :)
edit:
local tool = script.Parent local player = game.Players.LocalPlayer local character = game.Players.LocalPlayer.Character or player.CharacterAdded:Wait() local anim = script.Parent:WaitForChild("Animation") --No need to clone it tool.Equipped:Connect(function() animation = character:WaitForChild("Humanoid"):LoadAnimation(anim) if not animation then animation = character.Humanoid:LoadAnimation(animation) end animation:Play() end) script.Parent.Unequipped:Connect(function() animation:Stop() end)
local animation script.Parent.Equipped:Connect(function() animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation) animation:Play() end) script.Parent.Unequipped:Connect(function() animation:Stop() end) --Script that does work
I have fixed that. I found another script of animation that I have made a while ago that does work, I don't know what the error is but at least it works now.
I had this problem too...
Check if there is any other instance in your game that has your name