ApplyDamage.EnemyAttack = function(_, Damage, PlayerInfo, Knockback, AttackId)
local PlayerModel = PlayerInfo[1]
local UnitVector = PlayerInfo[2]
local PlayerHumanoid = PlayerModel:FindFirstChildOfClass("Humanoid")
local PlayerRoot = PlayerModel:FindFirstChild("HumanoidRootPart")
local AttackIds = require(PlayerModel.AttackIds)
local ValidAttack = table.find(AttackIds, AttackId)
print(AttackIds)
if table.find(AttackIds, AttackId) then
print("Same attack id, cancelling damage")
return
else
table.insert(AttackIds, AttackId)
task.delay(1, function()
table.remove(AttackIds, AttackId)
end)
end
print("Applied Damage")
warn(PlayerHumanoid:GetFullName())
PlayerHumanoid:TakeDamage(Damage)
if Knockback == 0 then return end
local Player = Players:FindFirstChild(PlayerModel.Name)
KnockbackPlayer:FireClient(Player, Knockback, PlayerRoot, UnitVector)
end
anybody know why takedamage doesn't work? the knockback event fires even when the damage doesn't do anything.
the humanoid is parented under my character btw