I have a issue with my M1 Combat, I have it working normally, but as when the player goes up with the target, like enemy player or npc I have a combo reset, so it goes back to 0 to air combat, but at the last hit it supposed to down slam to the ground but they get stuck in air
local function createHitbox(Damage)
local hitboxTemp = Hitboxes.Combat.M1:Clone()
hitboxTemp.CFrame = root.CFrame
hitboxTemp.Parent = root
local weld = Instance.new("Weld")
weld.Part0 = root
weld.Part1 = hitboxTemp
weld.C1 = require(hitboxTemp.weldCF)
weld.Parent = hitboxTemp
local hitboxZone = zonePlus.new(hitboxTemp)
hitboxZone:setAccuracy("Precise")
for i, v in pairs(hitboxZone:getParts()) do
if v.Parent ~= char then
if v.Parent:FindFirstChild("Humanoid") and not hit[v.Parent.Name] then
local eHum = v.Parent:FindFirstChild("Humanoid")
local eRoot = v.Parent:FindFirstChild("HumanoidRootPart")
if not v.Parent:FindFirstChild("Immune") and not char:FindFirstChild("Disabled") and not char:FindFirstChild("Immune") and not CS:HasTag(v.Parent, M1ImmunityTag) and not CS:HasTag(v.Parent, AirImmunityTag) then
CS:AddTag(v.Parent, M1ImmunityTag)
table.insert(hit, v.Parent.Name)
local isBlocking
if player then
isBlocking = char.isBlocking
else
isBlocking = v.Parent.isBlocking
v.Parent.Target.Value = player.Name
v.Parent.Idle.Value = false
end
if not CS:HasTag(v.Parent, "Perfect Block") then
if isBlocking.Value and root.CFrame.lookVector:Dot(eRoot.CFrame.lookVector) < 0.7 then
local blockBar = v.Parent:FindFirstChild("BlockBar")
if blockBar then
Replicate:FireAllClients("Combat", "Block Hit", eRoot)
blockBar.Value -= 8
coroutine.wrap(function()
local BV = Instance.new("BodyVelocity")
BV.MaxForce, BV.Velocity = Vector3.new(5e4, 5e2, 5e4), root.CFrame.lookVector * 10
BV.Parent = eRoot
game.Debris:AddItem(BV, 0.16)
end)()
end
else
--eHum:TakeDamage(M1Damage)
local packet = {
element = "Tai",
typee = "Blunt",
damage = Damage,
stun = 0.8,
speed = -7,
--knockback = nil,
--knockbackduration = 0,
--blockable = true,
--blockbreak = false,
}
DamageService.damage(player, eHum, char, packet)
Replicate:FireAllClients("Combat", "Basic Hit", eRoot)
Replicate:FireAllClients("Combat", "Indicator", Damage, eRoot)
Replicate:FireClient(player, "Hit")
--Replicate:FireClient(player, "CamShake", root.Position, 3, 100)
if Combo < 5 then
local punchsound = script.Sounds.PunchSound:Clone()
punchsound.Parent = eRoot
punchsound:Play()
game.Debris:AddItem(punchsound,1)
if not eHum:FindFirstChild("Animator") then
local anim = Instance.new("Animator",eHum)
anim.Name = "Animator"
end
local HitAnims = {
[1] = eHum.Animator:LoadAnimation(script.HitAnimations.Hit1),
[2] = eHum.Animator:LoadAnimation(script.HitAnimations.Hit2),
[3] = eHum.Animator:LoadAnimation(script.HitAnimations.Hit3),
[4] = eHum.Animator:LoadAnimation(script.HitAnimations.Hit4),
[5] = eHum.Animator:LoadAnimation(script.HitAnimations.Hit5),
}
if HitAnims[Combo] and HitAnims[Combo]:IsA("Animation") then
eHum.Animator:LoadAnimation(HitAnims[Combo]):Play()
end
end
if Combo < 4 then
coroutine.wrap(function()
local BV = Instance.new("BodyVelocity",eRoot)
BV.MaxForce, BV.Velocity = Vector3.new(5e4, 5e2, 5e4), root.CFrame.lookVector * 10
game.Debris:AddItem(BV, 0.1)
end)()
elseif Combo == 4 then
if not CV.Jumping then
coroutine.wrap(function()
local BV = Instance.new("BodyVelocity",eRoot)
BV.MaxForce, BV.Velocity = Vector3.new(5e4, 5e2, 5e4), root.CFrame.lookVector * 10
game.Debris:AddItem(BV, 0.1)
end)()
elseif CV.Jumping then
local BP = Instance.new("BodyPosition",root)
BP.Name = "AirUp"
BP.MaxForce = Vector3.new(4e4,4e4,4e4)
BP.Position = (root.CFrame * CFrame.new(0, 14, 0)).Position
BP.P = 4e4
game.Debris:AddItem(BP, 2.5)
local EnemyBP = Instance.new("BodyPosition",eRoot)
EnemyBP.Name = "AirUp"
EnemyBP.MaxForce = Vector3.new(4e4,4e4,4e4)
EnemyBP.Position = (eRoot.CFrame * CFrame.new(0, 14, -4)).Position
EnemyBP.P = 4e4
game.Debris:AddItem(EnemyBP, 2.5)
CV.OnAir = true
task.delay(4, function()
CV.OnAir = false
end)
end
elseif Combo == 5 then
if not CV.OnAir then
Misc.Ragdoll(v.Parent, 1 + 0.5)
coroutine.wrap(function()
local BV = Instance.new("BodyVelocity",eRoot)
BV.MaxForce, BV.Velocity = Vector3.new(5e4, 5e2, 5e4), root.CFrame.lookVector * 40
game.Debris:AddItem(BV, 0.15)
end)()
elseif CV.OnAir then
local Params = RaycastParams.new()
Params.FilterType = Enum.RaycastFilterType.Blacklist
Params.FilterDescendantsInstances = {char, v.Parent, workspace.Debris}
local raycastOrigin = root.Position
local raycastDirection = (root.CFrame * CFrame.Angles(math.rad(60), 0, 0)).UpVector * -100
local ray = workspace:Raycast(raycastOrigin, raycastDirection, Params)
if ray.Instance then
if (ray.Position - raycastOrigin).Magnitude < 40 then
if eRoot:FindFirstChild("AirUp") then
eRoot.AirUp:Destroy()
end
local EnemyBP = Instance.new("BodyPosition", eRoot)
EnemyBP.Name = "AirDown"
EnemyBP.MaxForce = Vector3.new(4e4, 4e4, 4e4)
EnemyBP.Position = ray.Position
EnemyBP.P = 4e4
game.Debris:AddItem(EnemyBP, 1)
task.delay(.3, function()
RS.Effects:FireAllClients("Combat", "AirDown", ray.Position, v.Parent)
end)
eRoot.CFrame = CFrame.new(ray.Position + Vector3.new(0, 2, 0))
end
end
Misc.Ragdoll(v.Parent, 1 + 0.5)
end
end
end
else
warn(player.Name .. " has been perfect blocked!")
Replicate:FireAllClients("Combat", "Perfect Block", eRoot)
Misc.InsertDisabled(char, 1.75)
end
task.delay(0.2, function()
CS:RemoveTag(v.Parent, M1ImmunityTag)
end)
end
end
end
end
game.Debris:AddItem(hitboxTemp, .3)
end