Whole script if neccessary

play = game.Players.LocalPlayer
char = play.Character
hum = char.Humanoid
rhand = char.RightHand
lhand = char.LeftHand
rep = game.ReplicatedStorage
equip = false
KeyHeld = false
quakeon = false
ten = true
debounce = 0

function onKeyPress(inputObject,gameProcessed)
	if inputObject.KeyCode == Enum.KeyCode.F and not equip then
		equip = true
		char.Folder.Equipped.Value = 1
		bisento = rep.Bisento:Clone()
		bisento.Parent = char
		hitbox = rep.hitbox:Clone()
		hitbox.Parent = char
		anim1 = hum:LoadAnimation(script.bisentoanim)
		anim1:Play()
	elseif inputObject.KeyCode == Enum.KeyCode.F and equip then
		if char:FindFirstChild("Bisento") then
			char.Bisento:Destroy()
		end
		if char:FindFirstChild("QuakeBall") then
			char.QuakeBall:Destroy()
		end
		if char:FindFirstChild("hitbox") then
			char.hitbox:Destroy()
		end
		quakeon = false
		equip = false
		char.Folder.Equipped.Value = 0
		anim1:Stop()
		end
		game:GetService("RunService").RenderStepped:Connect(function()
		if equip then
			bisento.CFrame = lhand.CFrame * CFrame.new(0,-0.5,-0.5)
			bisento.CFrame = bisento.CFrame * CFrame.Angles(0.3,1.2,-1.3)
			hitbox.CFrame = bisento.CFrame * CFrame.new(2,0,-9)
		end
			end)
	end

function onKeyPress2(inputObject,gameProcessed)
	if inputObject.KeyCode == Enum.KeyCode.Q and equip == true and quakeon == false then
		KeyHeld = true
		quake = rep.Parts.QuakeBall:Clone()
		quake.Parent = char
		quakeon = true
		game:GetService("RunService").RenderStepped:Connect(function()
			quake.CFrame = bisento.CFrame * CFrame.new(2.5,0,-9)
			while KeyHeld and quake.Size.Z < 7 do
				quake.Size = quake.Size + Vector3.new(0.025,0.025,0.025)
				wait(0.2)
			end
		end)
	end
end

function onKeyPress3(inputObject,gameProcessed)
	if inputObject.KeyCode == Enum.KeyCode.E and debounce == 0 then
		print(debounce)
		debounce = 1
		local attackanim = hum:LoadAnimation(script.bisentoattackanim1)
		attackanim:Play()
		print(debounce)
		wait(3)
		debounce = 0
		wait(0.2)
hitbox.Touched:Connect(function(hit)
	local ehum = hit.Parent:FindFirstChild("Humanoid") or hit.Parent.Parent:FindFirstChild("Humanoid")
	if ehum and ehum ~= hum and ten and attackanim.IsPlaying == true then
		ten = false
		ehum:TakeDamage(20)
		wait(3)
		ten = true
		end
	end)
end
end

game:GetService("UserInputService").InputBegan:Connect(onKeyPress)
game:GetService("UserInputService").InputBegan:Connect(onKeyPress2)
game:GetService("UserInputService").InputBegan:Connect(onKeyPress3)

This is the code that I'm having issues with, I'm not sure if .IsPlaying doesn't work anymore or why damage isn't being done during the animation.

Here's a GIF of the problem https://gyazo.com/e9a04e1eeb147bdd6449182f25537d0d

hitbox.Touched:Connect(function(hit)
	local ehum = hit.Parent:FindFirstChild("Humanoid") or hit.Parent.Parent:FindFirstChild("Humanoid")
	if ehum and ehum ~= hum and ten and attackanim.IsPlaying == true then
		ten = false
		ehum:TakeDamage(20)
		wait(3)
		ten = true
		end
	end)
end
end

If I remove the "and attackanim.IsPlaying == true" the hit detection works but I only want the player to receive damage whilst the animation is playing.

Here's what it looks like https://gyazo.com/1994b33343b59006356b3a9144f32178

2 comments

0

Are there any errors?

0

Nope