You can write your topic however you want, but you need to answer these questions:
I’m trying to make when you swing the lightsaber does damage
It doesn’t do damage tho
local hit2 = true
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local h = char:WaitForChild("Humanoid")
local AnimationTrack = h:LoadAnimation(script.Parent.main.swing)
script.Parent.Light.Touched:Connect(function(hit)
if AnimationTrack.IsPlaying then
local humanoid = hit.Parent:FindFirstChildWhichIsA ("Humanoid")
if humanoid then
if hit2 then
hit2 = false
humanoid.Health = humanoid.Health-20
wait(0.8)
hit2 = true
end
end
end
end)
If i remove the AnimationTrack.IsPlaying then it will do damage but I need to check if the animation is playing then do damage