So I have an animation inside a tool, which plays when you equip the tool and click it. It's a looping animation, and I want to make it so it stops when you click for a second time. Here's my current code:
Tool = script.parent
local player = game.Players.LocalPlayer
repeat wait() until player.Character ~= nil
local hum = player.Character:WaitForChild("Humanoid")
local animation = Tool.Animation
local AnimTrack = hum:LoadAnimation(animation)
Tool.Selected:connect(function(mouse)
mouse.Button1Down:connect(function()
AnimTrack:Play()
end)
end)

1 comment
Selected isn’t an event.