It's confusing me how the animation won't stop when it's dropped.
local tool = script.Parent
local handle = tool:WaitForChild("Handle")
local equipSound = handle:WaitForChild("EquipSound")
local function getHumanoid()
local char = player.Character or player.CharacterAdded:Wait()
return char:WaitForChild("Humanoid")
end
local humanoid = getHumanoid()
local idleAnim = humanoid:LoadAnimation(script:WaitForChild("Hold"))
local equipAnim = humanoid:LoadAnimation(script:WaitForChild("Equip"))
-- Equip
tool.Equipped:Connect(function()
equipSound:Play()
equipAnim:Play()
idleAnim.Looped = true
idleAnim:Play()
end)
-- Unequip/Drop
tool:GetPropertyChangedSignal("Parent"):Connect(function()
-- Stop idle anim if tool is not in the character anymore
if not tool:IsDescendantOf(player.Character) then
idleAnim:Stop()
end
end)
If anyone can help me, please tell me.
** You are now Level 5! **