local tool = script.Parent
local handle = tool.Handle
local idleLoop = script.idleloop
local player = tool.Parent.Parent
local char = player.Character
local humanoid = char.Humanoid
local basicIdle = script.basicidle
local idleloopPlay = humanoid:FindFirstChild("Animator"):LoadAnimation(idleLoop)
tool.Equipped:Connect(function()
idleloopPlay:Play()
end)
tool.Unequipped:Connect(function()
player.Backpack:WaitForChild(tool.Name)
idleloopPlay:Stop()
end)
you can fix this by changing the animation priority.
local tool = script.Parent
local idleLoop = script:FindFirstChild("idleloop") -- Use FindFirstChild to prevent errors
local player = tool.Parent and tool.Parent.Parent
if not player then return end -- Prevent errors if tool.Parent is nil
local char = player.Character
local humanoid = char and char:FindFirstChildOfClass("Humanoid")
if not humanoid then return end -- Ensure humanoid exists
local animator = humanoid:FindFirstChildOfClass("Animator")
if not animator or not idleLoop then return end -- Ensure animator and animation exist
local idleloopPlay = animator:LoadAnimation(idleLoop)
idleloopPlay.Priority = Enum.AnimationPriority.Action -- Set animation priority to Action
tool.Equipped:Connect(function()
idleloopPlay:Play()
end)
tool.Unequipped:Connect(function()
idleloopPlay:Stop()
end)