Hello, Im trying to play animation on tool click, but its not working and I don’t really know why.
No errors on console, just nothing.
Here is the local script:
wait(5)
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local animation = Humanoid:LoadAnimation(script.Parent.Animation)
script.Parent.Activated:Connect(function()
animation:Play()
end)
script.Parent.Unequipped:Connect(function()
animation:Stop()
end)
wait(5)
local Player = game.Players.LocalPlayer
local Character = workspace:WaitForChild(Player.Name)
local Humanoid = Character:WaitForChild("Humanoid")
animation=Humanoid:LoadAnimation(script.Parent.Animation)
function onActivation()
animation:Play()
print("Playing")
end
script.Parent.Activated:Connect(onActivation)
script.Parent.Unequipped:Connect(function()
animation:Stop()
print("Stopped")
end)