It works fine when you don't hit a player but when you do, the combo does not reset to 0.
local Cooldown = false local Combo = 0 local Delay = .35 local BasicAttack = 10 local FinalCombo = 15 local TimeToAttack = .8 local WSDBF = 0 local Delayersp = .1 script.Parent.OnServerEvent:Connect(function(Player, Stunned) if Stunned.Value == true then return end Combo = Combo + 1 local SwingFist = script.Swing if Combo == 1 then local rightPunch = Player.Character.Humanoid:LoadAnimation(script.rightPunch) rightPunch:Play() SwingFist:Play() for i,v in pairs(game.Workspace:GetChildren()) do local m = (v:IsA("Model") and v) or nil if m and m:FindFirstChild("Humanoid") and m:FindFirstChild("HumanoidRootPart") and m ~= Player.Character then if (Player.Character.HumanoidRootPart.Position - m.HumanoidRootPart.Position).magnitude <= 20 then m.Humanoid:TakeDamage(BasicAttack) local Punched1 = script.Punched1:Clone() Punched1.Parent = m.HumanoidRootPart Punched1:Play() game.Debris:AddItem(Punched1,.5) local track = m.Humanoid:LoadAnimation(script.PunchedLeft) track:Play() local BodyVelocity = Instance.new("BodyVelocity",Player.Character.HumanoidRootPart) BodyVelocity.Velocity = Player.Character.HumanoidRootPart.CFrame.lookVector * 10 BodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge) game.Debris:AddItem(BodyVelocity,.1) local NormalHit = game.ReplicatedStorage.NormalHit:Clone() NormalHit.Parent = workspace local Weld = Instance.new("Weld",NormalHit) Weld.Part0 = NormalHit Weld.Part1 = m.Head Weld.C1 = CFrame.new(0,0,-1) game.Debris:AddItem(NormalHit,.3) m.Humanoid.WalkSpeed = m.HumanoidWalkspeed + WSDBF spawn(function() wait(Delay+Delayersp) m.Humanoid.WalkSpeed = m.HumanoidWalkspeed + WSDBF end) end end end spawn(function() wait(TimeToAttack) if Combo == 2 then else Combo = 0 end end) else if Combo == 2 then spawn(function() wait(TimeToAttack) if Combo == 3 then else Combo = 0 end end) local leftPunch = Player.Character.Humanoid:LoadAnimation(script.leftPunch) leftPunch:Play() SwingFist:Play() for i,v in pairs(game.Workspace:GetChildren()) do local m = (v:IsA("Model") and v) or nil if m and m:FindFirstChild("Humanoid") and m:FindFirstChild("HumanoidRootPart") and m ~= Player.Character then if (Player.Character.HumanoidRootPart.Position - m.HumanoidRootPart.Position).magnitude <= 20 then m.Humanoid:TakeDamage(BasicAttack) local Punched1 = script.Punched1:Clone() Punched1.Parent = m.HumanoidRootPart Punched1:Play() game.Debris:AddItem(Punched1,.5) local track = m.Humanoid:LoadAnimation(script.PunchedRight) track:Play() local BodyVelocity = Instance.new("BodyVelocity",Player.Character.HumanoidRootPart) BodyVelocity.Velocity = Player.Character.HumanoidRootPart.CFrame.lookVector * 10 BodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge) game.Debris:AddItem(BodyVelocity,.1) local NormalHit = game.ReplicatedStorage.NormalHit:Clone() NormalHit.Parent = workspace local Weld = Instance.new("Weld",NormalHit) Weld.Part0 = NormalHit Weld.Part1 = m.Head Weld.C1 = CFrame.new(0,0,-1) game.Debris:AddItem(NormalHit,.3) m.Humanoid.WalkSpeed = m.HumanoidWalkspeed + WSDBF spawn(function() wait(Delay+Delayersp) m.Humanoid.WalkSpeed = m.HumanoidWalkspeed + WSDBF end) end end end else if Combo == 3 then local rightUpperCut = Player.Character.Humanoid:LoadAnimation(script.rightUpperCut) rightUpperCut:Play() SwingFist:Play() spawn(function() wait(TimeToAttack) if Combo == 4 then else Combo = 0 end local RightArm = false end) for i,v in pairs(game.Workspace:GetChildren()) do local m = (v:IsA("Model") and v) or nil if m and m:FindFirstChild("Humanoid") and m:FindFirstChild("HumanoidRootPart") and m ~= Player.Character then if (Player.Character.HumanoidRootPart.Position - m.HumanoidRootPart.Position).magnitude <= 20 then m.Humanoid:TakeDamage(BasicAttack) local Punched1 = script.Punched1:Clone() Punched1.Parent = m.HumanoidRootPart Punched1:Play() game.Debris:AddItem(Punched1,.5) local track = m.Humanoid:LoadAnimation(script.leftUpperCutPunch) track:Play() local BodyVelocity = Instance.new("BodyVelocity",Player.Character.HumanoidRootPart) BodyVelocity.Velocity = Player.Character.HumanoidRootPart.CFrame.lookVector * 10 BodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge) game.Debris:AddItem(BodyVelocity,.1) local NormalHit = game.ReplicatedStorage.NormalHit:Clone() NormalHit.Parent = workspace local Weld = Instance.new("Weld",NormalHit) Weld.Part0 = NormalHit Weld.Part1 = m.Head Weld.C1 = CFrame.new(0,0,-1) game.Debris:AddItem(NormalHit,.3) m.Humanoid.WalkSpeed = m.HumanoidWalkspeed + WSDBF spawn(function() wait(Delay+Delayersp) m.Humanoid.WalkSpeed = m.HumanoidWalkspeed + WSDBF end) end end end else if Combo == 4 then local leftUpperCut = Player.Character.Humanoid:LoadAnimation(script.leftUpperCut) leftUpperCut:Play() SwingFist:Play() spawn(function() wait(TimeToAttack) if Combo == 5 then else Combo = 0 end local RightArm = false end) for i,v in pairs(game.Workspace:GetChildren()) do local m = (v:IsA("Model") and v) or nil if m and m:FindFirstChild("Humanoid") and m:FindFirstChild("HumanoidRootPart") and m ~= Player.Character then if (Player.Character.HumanoidRootPart.Position - m.HumanoidRootPart.Position).magnitude <= 20 then m.Humanoid:TakeDamage(BasicAttack) local Punched1 = script.Punched1:Clone() Punched1.Parent = m.HumanoidRootPart Punched1:Play() game.Debris:AddItem(Punched1,.5) local track = m.Humanoid:LoadAnimation(script.rightUpperCutFace) track:Play() local BodyVelocity = Instance.new("BodyVelocity",Player.Character.HumanoidRootPart) BodyVelocity.Velocity = Player.Character.HumanoidRootPart.CFrame.lookVector * 10 BodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge) game.Debris:AddItem(BodyVelocity,.1) local NormalHit = game.ReplicatedStorage.NormalHit:Clone() NormalHit.Parent = workspace local Weld = Instance.new("Weld",NormalHit) Weld.Part0 = NormalHit Weld.Part1 = m.Head Weld.C1 = CFrame.new(0,0,-1) game.Debris:AddItem(NormalHit,.3) m.Humanoid.WalkSpeed = m.HumanoidWalkspeed + WSDBF spawn(function() wait(Delay+Delayersp) m.Humanoid.WalkSpeed = m.HumanoidWalkspeed + WSDBF end) end end end else if Combo == 5 then local Kick = Player.Character.Humanoid:LoadAnimation(script.Kick) Kick:Play() SwingFist:Play() for i,v in pairs(game.Workspace:GetChildren()) do local m = (v:IsA("Model") and v) or nil if m and m:FindFirstChild("Humanoid") and m:FindFirstChild("HumanoidRootPart") and m ~= Player.Character then if (Player.Character.HumanoidRootPart.Position - m.HumanoidRootPart.Position).magnitude <= 20 then m.Humanoid:TakeDamage(BasicAttack) local Punched1 = script.Punched1:Clone() Punched1.Parent = m.HumanoidRootPart Punched1:Play() game.Debris:AddItem(Punched1,.5) local track = m.Humanoid:LoadAnimation(script.kicakFace) track:Play() local BodyVelocity = Instance.new("BodyVelocity",Player.Character.HumanoidRootPart) BodyVelocity.Velocity = Player.Character.HumanoidRootPart.CFrame.lookVector * 10 BodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge) game.Debris:AddItem(BodyVelocity,.1) local NormalHit = game.ReplicatedStorage.NormalHit:Clone() NormalHit.Parent = workspace local Weld = Instance.new("Weld",NormalHit) Weld.Part0 = NormalHit Weld.Part1 = m.Head Weld.C1 = CFrame.new(0,0,-1) game.Debris:AddItem(NormalHit,.3) m.Humanoid.WalkSpeed = m.HumanoidWalkspeed + WSDBF spawn(function() wait(Delay+Delayersp) m.Humanoid.WalkSpeed = m.HumanoidWalkspeed + WSDBF end) end end end Combo = 0 end end end end end end)
wait(2) local Cooldown = false local Player = game.Players.LocalPlayer local Character = Player.Character local Stunned = Character.Stunned local Mouse = Player:GetMouse() local Delay = .35 Mouse.Button1Down:Connect(function() if Stunned.Value == true then return end if Cooldown then return end spawn(function() Cooldown = true wait(Delay) Cooldown = false end) script.RemoteEvent:FireServer(Stunned) for i,v in pairs(game.Workspace:GetChildren()) do local m = (v:IsA("Model") and v) or nil if m and m:FindFirstChild("Humanoid") and m:FindFirstChild("HumanoidRootPart") and m ~= Player.Character then if (Player.Character.HumanoidRootPart.Position - m.HumanoidRootPart.Position).magnitude <= 20 then m.Stunned.Value = true spawn(function() wait(Delay+6) m.Stunned.Value = false end) end end end end)