Sometime the hitbox touched the enemy they take dmg and sometime they dosent , i want to make it deal damage every single time if the hitbox touched the enemy so how should i fix it? here scripts
local Hitbox = game:GetService("ServerStorage").Items.BlockItems.Hitbox:Clone()
Hitbox.Parent = workspace.FX
Hitbox.CFrame = Stand.PrimaryPart.CFrame * CFrame.new(0,0,-3)
local HittedList = {}
Hitbox.Touched:Connect(function(hitpart)
if hitpart.Parent:FindFirstChildWhichIsA("Humanoid") and not hitpart:IsDescendantOf(char) then
local enemy = hitpart.Parent
if (table.find(HittedList,enemy) == nil) then
table.insert(HittedList,enemy)
if enemy:FindFirstChild("GetDamaged").Value == false then
OutputEvent:FireAllClients(enemy, "FX", "RequestSFX", "NormalHitSFX")
if enemy:FindFirstChild("Timestopped") then
repeat
wait()
until not enemy:FindFirstChild("Timestopped")
end
OutputEvent:FireAllClients(enemy, "FX", "HitFX", "Normal")
local vel = Instance.new("BodyVelocity",enemy.HumanoidRootPart)
vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
vel.Velocity = char.HumanoidRootPart.CFrame.lookVector * 1 + Vector3.new(0,0,0)
deb:AddItem(vel,0.15)
enemy:FindFirstChildWhichIsA("Humanoid"):LoadAnimation(ServerStorage.Items.Animations.HitAnim):Play()
enemy:FindFirstChildWhichIsA("Humanoid"):TakeDamage(Stat.Damage)
Functions.OnTouched(char, enemy, Stat.Damage)
Functions.StunPlayer(enemy, 1.5)
end
end
end
end)
deb:AddItem(Hitbox,.1)
