hello all i tried to make healing item and got bug when animation plays after tool destroyed idle anim plays
there code of healing item
script.Parent.Activated:Connect(function()
local plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
local hum = plr.Character.Humanoid
local anim = hum:LoadAnimation(script.Parent.Heal)
anim:Play()
script.Parent.Handle.Sound:Play()
hum.WalkSpeed = 0wait(6.5)
hum.Health += 100
script.Parent:Destroy()
hum.WalkSpeed = 16
end)
and idle animation script
local tool = script.Parent
local anim = Instance.new(“Animation”)
local anim1 = Instance.new(“Animation”)
anim.Name = “IdleAnim”
anim.AnimationId = “rbxassetid://17694511302” – Idle Animaton ID
anim1.Name = “EquipAnim”
anim1.AnimationId = “rbxassetid://17694317283”-- Equip Tool Animaton ID
local track
local track1tool.Equipped:Connect(function()
track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
track1 = script.Parent.Parent.Humanoid:LoadAnimation(anim1)
track.Priority = Enum.AnimationPriority.Movement
track1.Priority = Enum.AnimationPriority.Movement
track.Looped = true
track:Play()
track1:Play()
end)tool.Unequipped:Connect(function()
if track and track1 then
track:Stop()
track1:Stop()
end
end)
(sorry for bad english,because im learning this language)