I have a combat script that is activated when the hitbox on limbs touches the enemy, but I have a problem that the enemy can still hit me back while getting hit.
Hitbox.Touched:Connect(function(Hit)
if Hit:IsA("BasePart") then
if not Hit:IsDescendantOf(Character) then
local enemyHumanoid = Hit.Parent:FindFirstChild("Humanoid")
local emnemyHumrp = Hit.Parent:FindFirstChild("HumanoidRootPart"
if enemyHumanoid and emnemyHumrp then
Hitbox:Destroy()
enemyHumanoid:TakeDamage(Damage)
local react = enemyHumanoid:LoadAnimation(eAnims[count])
react.Name = "React"
react:Play()
print("Played")
local AnimationTracks = enemyHumanoid:GetPlayingAnimationTracks()
for i, v in pairs(AnimationTracks) do
if v.name ~= "React" then
v:Stop(2)
end

2 comments
I think the best thing to do in this situation is to add a boolean that changes from false to true when you get hit, and just add an if statement with that boolean to see if you can hit. and when you stop the anim you can set the boolean to false.
Can you show me an example how to do that