Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Combo = 0
- local TimeToAttack = .8 -- time in between attacks before it resets to 0
- local Damage = 6 -- damage done to the player
- local Range = 7 -- Range around you
- local replicatedStorage = game:GetService("ReplicatedStorage")
- local CMB = true
- script.Parent.OnServerEvent:Connect(function(Player, EnemBlocking)
- local Character = Player.Character
- local Humanoid = Character.Humanoid
- Combo = Combo + 1
- local leftPunch = Humanoid:LoadAnimation(script.leftPunch)
- local rightPunch = Humanoid:LoadAnimation(script.rightPunch)
- local leftUpperCut = Humanoid:LoadAnimation(script.leftUpperCut)
- local rightUpperCut = Humanoid:LoadAnimation(script.rightUpperCut)
- 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 ~= Character then
- if (Character.HumanoidRootPart.Position - m.HumanoidRootPart.Position).magnitude <= Range then
- if Combo == 1 or Combo == 2 or Combo == 3 or Combo == 4 or Combo == 5 then
- if CMB == false then return end
- local hiteffect = replicatedStorage:WaitForChild("HitEffect"):Clone()
- hiteffect.CanCollide = false
- hiteffect.Anchored = true
- hiteffect.CFrame = m.HumanoidRootPart.CFrame
- hiteffect.Parent = workspace
- game.Debris:AddItem(hiteffect,0.4)
- local hit = Instance.new("BoolValue",m)
- hit.Name = "Hit"
- game.Debris:AddItem(hit,0.7)
- m.Humanoid:TakeDamage(Damage)
- spawn(function()
- m.CMB = false
- m.Humanoid.WalkSpeed = 1
- m.Humanoid.JumpPower = 1
- wait(1)
- m.CMB = true
- m.Humanoid.WalkSpeed = 16
- m.Humanoid.JumpPower = 50
- end)
- end
- if Combo == 1 then
- local Punched1 = script.Punched1:Clone()
- Punched1.Parent = m.Head
- Punched1:Play()
- game.Debris:AddItem(Punched1,.4)
- m.Humanoid:LoadAnimation(script.PunchedRight):Play()
- end
- if Combo == 2 then
- local Punched2 = script.Punched2:Clone()
- Punched2.Parent = m.Head
- Punched2:Play()
- game.Debris:AddItem(Punched2,.4)
- m.Humanoid:LoadAnimation(script.PunchedLeft):Play()
- end
- if Combo == 3 then
- local Punched3 = script.Punched3:Clone()
- Punched3.Parent = m.Head
- Punched3:Play()
- game.Debris:AddItem(Punched3,.4)
- m.Humanoid:LoadAnimation(script.rightUpperCutFace):Play()
- end
- if Combo == 4 then
- local Punched4 = script.Punched4:Clone()
- Punched4.Parent = m.Head
- Punched4:Play()
- game.Debris:AddItem(Punched4,.3)
- m.Humanoid:LoadAnimation(script.leftUpperCutPunch):Play()
- end
- end
- end
- end
- if Combo == 1 then
- leftPunch:Play()
- local Swing = script.SwingFist:Clone()
- Swing.Parent = Character.HumanoidRootPart
- Swing:Play()
- else if Combo == 2 then
- rightPunch:Play()
- local Swing = script.SwingFist:Clone()
- Swing.Parent = Character.HumanoidRootPart
- Swing:Play()
- spawn(function()
- wait(TimeToAttack)
- if Combo == 2 then
- Combo = 0
- end
- end)
- else if Combo == 3 then
- leftUpperCut:Play()
- local Swing = script.SwingFist:Clone()
- Swing.Parent = Character.HumanoidRootPart
- Swing:Play()
- spawn(function()
- wait(TimeToAttack)
- if Combo == 3 then
- Combo = 0
- end
- end)
- else if Combo == 4 then
- rightUpperCut:Play()
- local Swing = script.SwingFist:Clone()
- Swing.Parent = Character.HumanoidRootPart
- Swing:Play()
- spawn(function()
- wait(TimeToAttack)
- if Combo == 4 then
- Combo = 0
- end
- end)
- Combo = 100
- wait(2)
- Combo = 0
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement