idk why i cant deal damage to the opponent, i made a hitbox system i tried but it didnt deal damage
https://gyazo.com/bce6e66dd1124b4c3d219e97576cd6c3
this is my script
local function DamagePlayer()
local hitbox = importantfile.Hitbox:Clone()
hitbox.Parent = workspace
hitbox.CFrame = rootpart.CFrame * CFrame.new(0,0,-2.5)
deb:AddItem(hitbox,.5)
local ignorelist = {}
local weld = Instance.new("WeldConstraint")
weld.Parent = hitbox
weld.Part1 = rootpart
weld.Part0 = hitbox
hitbox.Touched:Connect(function(hitpart)
if not hitpart:IsDescendantOf(char) then
if hitpart.Parent:FindFirstChildWhichIsA("Humanoid") then
local enemy = hitpart.Parent
if enemy:WaitForChild("GetDamaged").Value == false then
if (table.find(ignorelist,enemy) == nil) then
table.insert(ignorelist,enemy)
if enemy.HumanoidRootPart.Anchored == true then
repeat
wait()
until enemy.HumanoidRootPart.Anchored == false
end
enemy:FindFirstChildWhichIsA("Humanoid"):TakeDamage(normaldamage)
local hitsound = importantfile.HitSound:Clone()
hitsound.Parent = enemy.HumanoidRootPart
hitsound:Play()
local knockback = Instance.new("BodyVelocity")
knockback.MaxForce = Vector3.new(1e6,1e6,1e6)
knockback.Velocity = char.PrimaryPart.CFrame.LookVector * 0.5
knockback.Parent = enemy.PrimaryPart
enemy:WaitForChild("UsingMove").Value = true
enemy:FindFirstChildWhichIsA("Humanoid").WalkSpeed = 3
task.wait(stuntime)
enemy:WaitForChild("UsingMove").Value = false
enemy:FindFirstChildWhichIsA("Humanoid").WalkSpeed = 16
deb:AddItem(knockback,.5)
deb:AddItem(hitsound,3)
end
end
end
end
end)
end