I was doing some animations to my new game about mining
and my animation for diging is not working
Can someone help me with this ?
This is my script
local anim = tool:WaitForChild("Animation")
local connection = nil
local player = nil
local char = nil
local track = nil
local function onActivated()
track:Play()
wait(5)
track:Stop()
end
local function onEquipped()
player = game.Players.LocalPlayer
connection = tool.Activated:Connect(onActivated)
char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
track = hum.Animator:LoadAnimation(anim)
end
local function onUnequipped()
player = nil
char = nil
connection:Disconnect()
end
tool.Equipped:Connect(onEquipped)
tool.Unequipped:Connect(onUnequipped)