local bussy = false
local lastSlasj = tick()
local player = game.Players.LocalPlayer
local char = player.Character
wait(1)
local aims = { ["idle"] = nil
}
script.Parent.Equipped:Connect(function()
local char = player.Character
aims.idle = Enum.AnimationPriority.Idle
aims.idle = char.Humanoid:LoadAnimation(script.Parent.idle)
aims.idle:Play()
end)
COMMUNITY QUESTION
sword animation plays after being unequipped but not when equipped how do i fix?
1 answer
When you call the AnimationPlayer (anim.idle) you need to have this predefined, because every time you equip the tool, the animation will be loaded again and you won't be able to stop it with another function except the .Equipped event you first created it in.
It is also probably better to name your variable something without a period in its name, since the period denotes the hierarchy of the variable you are going to call.
You also defined "aims.idle" twice, so the second definition will override the first. Since the first definition is a property (Priority), you can define this after setting the variable.
LocalScript
local bussy = false
local lastSlasj = tick()
local player = game.Players.LocalPlayer
local char = workspace:WaitForChild(player.Name)
wait(1)
local aims = {["idle"] = nil}
local animPlayer = char.Humanoid:LoadAnimation(script.Parent.idle)
animPlayer.Priority = Enum.AnimationPriority.Idle
script.Parent.Equipped:Connect(function()
animPlayer:Play()
end)
script.Parent.Unequipped:Connect(function()
animPlayer:Stop()
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
i have 2 chars because it kept saying character is a nill value also i tryed put the Priority to action dose the same thing