I am making a game with weapons, and I want an idle animation to play while the weapon is equipped, but it won’t play. This code is inside of a local script
while script.Parent.Equipped == true do
wait(1)
local animation = script.Parent:WaitForChild('Idle')
local humanoid = script.Parent:WaitForChild('Humanoid')
local idle = humanoid:LoadAnimation(animation)
idle:Play()
end
while script.Parent.Equipped == true do
wait(1)
local animation = script.Parent:WaitForChild('Idle')
local humanoid = script.Parent:WaitForChild('Humanoid')
local animator = humanoid:WaitForChild("Animator")
local idle = animator:LoadAnimation(animation)
idle:Play()
end