script.Parent.Activated:Connect(function()
local animation = script.Parent.Animation
local animationtrack = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(animation)
animationtrack:Play()
script.Parent.Handle.Touched:Connect(function(Hit)
if animationtrack.IsPlaying then
Hit.Parent:FindFirstChild("Humanoid"):TakeDamage(5)
else
script.Parent.Handle.Touched:Disconnect() -- problem
end
end)
end)
I am trying to disconnect the event, but it just gives me an error instead.

3 comments
ahem...
Your answer doesn't even work. I am not accepting something that is broken.
first of all add a local with the name you want, like local event = script.Parent.Activated:Connect(function() then after that do event:Disconnect() outside but not inside th ecode