Advertisement
Scripting_King

Request For Hire

Sep 7th, 2023
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 21.85 KB | Source Code | 0 0
  1. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  2. local PunchRemote = ReplicatedStorage.Remotes.Punching
  3. local BlockRemote = ReplicatedStorage.Remotes.Blocking
  4. local M2Remote = ReplicatedStorage.Remotes.M2Remote
  5.  
  6.  
  7. ----- Folders
  8. local AnimationsFolder = script:WaitForChild("Animations")
  9. local PlayerAnimations = AnimationsFolder:WaitForChild("Player")
  10. local EnemyAnimations = AnimationsFolder:WaitForChild("Enemy")
  11. local SoundFolder = script:WaitForChild("Sounds")
  12.  
  13.  
  14. ------ Player Animations
  15. local Punch1 = PlayerAnimations:WaitForChild("RightPunch")
  16. local Punch2 = PlayerAnimations:WaitForChild("LeftPunch")
  17. local Punch3 = PlayerAnimations:WaitForChild("RightPunch1")
  18. local Punch4 = PlayerAnimations:WaitForChild("LeftPunch1")
  19. local Punch5 = PlayerAnimations:WaitForChild("Final")
  20.  
  21.  
  22.  
  23.  
  24. ---- Enemy Animations
  25. local LeftHit = EnemyAnimations:WaitForChild("LeftHit")
  26. local KnockBack = EnemyAnimations:WaitForChild("KnockBack")
  27. local RightHit = EnemyAnimations:WaitForChild("RightHit")
  28. local Blocked = EnemyAnimations:WaitForChild("Blocked")
  29. local Break = EnemyAnimations:WaitForChild("Break")
  30.  
  31. --- Sounds
  32. local PunchSwing = SoundFolder:WaitForChild("SwingFist")
  33. local HitSound = SoundFolder:WaitForChild("Hit")
  34. local BlockSound = SoundFolder:WaitForChild("BlockedSound")
  35. local Heavy = SoundFolder:WaitForChild("Heavy")
  36. local BlockBreakSound = SoundFolder:WaitForChild("BlockBreak")
  37.  
  38. --- Booleans
  39. local CanHit = true
  40. local Equipped = false
  41.  
  42. ---- effects
  43. local Effects = script:WaitForChild("Effects")
  44.  
  45. local HitEffect = Effects:WaitForChild("HitEffect")
  46. local AttachmentHit = HitEffect.Attachment
  47. local BlockEffect = Effects:WaitForChild("BlockEffect")
  48. local AttachmentBlock = BlockEffect.Attachment
  49. local breakEffect = Effects:WaitForChild("BreakEffect")
  50. local AttachmentBreak = breakEffect.Attachment
  51.  
  52. local Shake = script:WaitForChild("ShakeScript")
  53.  
  54. -- Billboards
  55. local StunnedGui = script:WaitForChild("Stunned")
  56. local ParryGui = script:WaitForChild("Parry")
  57.  
  58. local blockAnimationId = "rbxassetid://14358636029"
  59.  
  60. ------- Configurations
  61. local BasicDamage = 5
  62. local FinalDamage = 8
  63. local BasicStun = .5
  64. local FinalStun = 1
  65.  
  66. local ParriedDebounce = true
  67.  
  68. PunchRemote.OnServerEvent:Connect(function(player, Combo)
  69.     print("Fired")
  70.     local Character = player.Character
  71.     local Humanoid = Character:WaitForChild("Humanoid")
  72.     local PlayerParriedCount = Character:FindFirstChild("ParriedCount")
  73.    
  74.     if Combo == 1 then ---- the first Punch
  75.         CanHit = true
  76.         -- sound
  77.         local Swingy = PunchSwing:Clone()
  78.         Swingy.Parent = Character.HumanoidRootPart
  79.         Swingy:Play()
  80.         game.Debris:AddItem(Swingy,2)
  81.        
  82.         ---- animation
  83.         print("Combo Recieved")
  84.         local anim = Humanoid:LoadAnimation(Punch1)
  85.         anim:Play()
  86.        
  87.         ------- hit box instance
  88.        
  89.         local hitbox = Instance.new("Part", Character)
  90.         hitbox.Anchored = false
  91.         hitbox.CanCollide = false
  92.         hitbox.Size = Character.HumanoidRootPart.Size
  93.         hitbox.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, -2.5)
  94.         hitbox.Transparency = 1
  95.  
  96.         local hitboxWeld = Instance.new("ManualWeld")
  97.         hitboxWeld.Name = "HitboxWeld"
  98.         hitboxWeld.Part0 = hitbox
  99.         hitboxWeld.Part1 = Character.HumanoidRootPart
  100.         hitboxWeld.C0 = hitbox.CFrame:ToObjectSpace(Character.HumanoidRootPart.CFrame)
  101.         hitboxWeld.Parent = hitbox
  102.        
  103.         ---- HitBox touched
  104.        
  105.         hitbox.Touched:Connect(function(hit)
  106.             if CanHit == false then return end
  107.             if hit.Parent:FindFirstChild("Humanoid") then
  108.                 local Parry = hit.Parent:FindFirstChild("Parry")
  109.                
  110.                 if Parry.Value == true then
  111.                    
  112.                     coroutine.wrap(function()
  113.                         if ParriedDebounce then
  114.                             ParriedDebounce = false
  115.                             PlayerParriedCount.Value = PlayerParriedCount.Value + 1
  116.                             wait(1.5)
  117.                             ParriedDebounce = true
  118.                         end
  119.                     end)()
  120.                                                                        
  121.                    
  122.                     Character.Stunned.Value = true
  123.                     Humanoid.WalkSpeed = 0
  124.                    
  125.                     local ui = ParryGui:Clone()
  126.                     ui.Parent = Character.Head
  127.                     game.Debris:AddItem(ui,BasicStun)
  128.                    
  129.                     wait(BasicStun)
  130.                     Character.Stunned.Value = false
  131.                     Humanoid.WalkSpeed = 16
  132.                    
  133.                 end
  134.                
  135.                 if not hit:IsDescendantOf(Character) then
  136.                     if Parry.Value == true then return end
  137.  
  138.                     if hit.Parent.Blocking.Value == false then
  139.                         CanHit = false
  140.                     local enemyHum = hit.Parent:FindFirstChild("Humanoid")
  141.                     enemyHum:TakeDamage(BasicDamage)
  142.                     local HitAnimation = enemyHum:LoadAnimation(LeftHit)
  143.                     HitAnimation:Play()
  144.                    
  145.                     local Hitty = HitSound:Clone()
  146.                     Hitty.Parent = Character.HumanoidRootPart
  147.                     Hitty:Play()
  148.                     game.Debris:AddItem(Hitty,2)
  149.                        
  150.                     local hitToCharacterDir = (Character.HumanoidRootPart.Position - hit.Parent.HumanoidRootPart.Position).unit
  151.  
  152.                        
  153.                     local Atttachy = AttachmentHit:Clone()
  154.                     Atttachy.Parent = hit.Parent.HumanoidRootPart
  155.                     Atttachy.Ring:Emit(1)
  156.                     Atttachy.Sparks:Emit(20)   
  157.                     Atttachy.Residue:Emit(20)  
  158.                     Atttachy.CenterSpark:Emit(1)
  159.                        
  160.                     game.Debris:AddItem(Atttachy,2)
  161.                        
  162.                     hit.Parent.Stunned.Value = true
  163.                     enemyHum.WalkSpeed = 0
  164.  
  165.                     local ui = StunnedGui:Clone()
  166.                     ui.Parent = hit.Parent.Head
  167.                     game.Debris:AddItem(ui,BasicStun)
  168.                    
  169.  
  170.                        
  171.                     CanHit = false
  172.                         hitbox:Destroy()
  173.                         wait(BasicStun)
  174.                         hit.Parent.Stunned.Value = false
  175.                         enemyHum.WalkSpeed = 16
  176.                     else
  177.                         local Hitty = BlockSound:Clone()
  178.                         Hitty.Parent = Character.HumanoidRootPart
  179.                         Hitty:Play()
  180.                         game.Debris:AddItem(Hitty,2)
  181.  
  182.                         CanHit = false
  183.                         print("Blocking")
  184.                         local enemyHum = hit.Parent:FindFirstChild("Humanoid")
  185.                        
  186.                         local HitAnimation = enemyHum:LoadAnimation(Blocked)
  187.                         HitAnimation:Play()
  188.                        
  189.                         local Atttachy = AttachmentBlock:Clone()
  190.                         Atttachy.Parent = hit.Parent.HumanoidRootPart
  191.                         Atttachy.Radial:Emit(1)
  192.                         Atttachy.CenterStar:Emit(30)   
  193.                         Atttachy.Sparks:Emit(30)   
  194.                         game.Debris:AddItem(Atttachy,2)
  195.                        
  196.                         -- Apply BodyVelocity to push the player
  197.                        
  198.                         local vel = Instance.new("BodyVelocity")
  199.                         vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  200.                         vel.Parent = hit.Parent.HumanoidRootPart
  201.                         vel.Velocity = hit.Parent.HumanoidRootPart.CFrame.LookVector * -2
  202.                         vel.Name  =  "SmallMoveVel"
  203.                         game.Debris:AddItem(vel,.7)
  204.                     end
  205.                 end
  206.             end
  207.         end)
  208.         wait(.5)
  209.         hitbox:Destroy()
  210.     end -- last end for Combo == 1
  211.    
  212.     if Combo == 2 then ---- the second Punch
  213.         CanHit = true
  214.         -- sound
  215.         local Swingy = PunchSwing:Clone()
  216.         Swingy.Parent = Character.HumanoidRootPart
  217.         Swingy:Play()
  218.         game.Debris:AddItem(Swingy,2)
  219.        
  220.         ---- animation
  221.         print("Combo Recieved")
  222.         local anim = Humanoid:LoadAnimation(Punch2)
  223.         anim:Play()
  224.        
  225.         ------- hit box instance
  226.        
  227.         local hitbox = Instance.new("Part", Character)
  228.         hitbox.Anchored = false
  229.         hitbox.CanCollide = false
  230.         hitbox.Size = Character.HumanoidRootPart.Size
  231.         hitbox.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, -2.5)
  232.         hitbox.Transparency = 1
  233.  
  234.         local hitboxWeld = Instance.new("ManualWeld")
  235.         hitboxWeld.Name = "HitboxWeld"
  236.         hitboxWeld.Part0 = hitbox
  237.         hitboxWeld.Part1 = Character.HumanoidRootPart
  238.         hitboxWeld.C0 = hitbox.CFrame:ToObjectSpace(Character.HumanoidRootPart.CFrame)
  239.         hitboxWeld.Parent = hitbox
  240.        
  241.         ---- HitBox touched
  242.        
  243.         hitbox.Touched:Connect(function(hit)
  244.             if CanHit == false then return end
  245.             if hit.Parent:FindFirstChild("Humanoid") then
  246.                
  247.                 local Parry = hit.Parent:FindFirstChild("Parry")
  248.  
  249.                 if Parry.Value == true then
  250.  
  251.                     hit.Parent.Stunned.Value = true
  252.                     Humanoid.WalkSpeed = 0
  253.  
  254.                     local ui = ParryGui:Clone()
  255.                     ui.Parent = Character.Head
  256.                     game.Debris:AddItem(ui,BasicStun)
  257.  
  258.                     wait(BasicStun)
  259.                     hit.Parent.Stunned.Value = false
  260.                     Humanoid.WalkSpeed = 16
  261.  
  262.                 end
  263.                
  264.                 if not hit:IsDescendantOf(Character) then
  265.                     if Parry.Value == true then return end
  266.  
  267.                     if hit.Parent.Blocking.Value == false then
  268.                         CanHit = false
  269.                     local enemyHum = hit.Parent:FindFirstChild("Humanoid")
  270.                     enemyHum:TakeDamage(BasicDamage)
  271.                     local HitAnimation = enemyHum:LoadAnimation(RightHit)
  272.                     HitAnimation:Play()
  273.                    
  274.                     local Hitty = HitSound:Clone()
  275.                     Hitty.Parent = Character.HumanoidRootPart
  276.                     Hitty:Play()
  277.                     game.Debris:AddItem(Hitty,2)
  278.                        
  279.                     local Atttachy = AttachmentHit:Clone()
  280.                     Atttachy.Parent = hit.Parent.HumanoidRootPart
  281.                     Atttachy.Ring:Emit(1)
  282.                     Atttachy.Sparks:Emit(20)   
  283.                     Atttachy.Residue:Emit(20)  
  284.                     Atttachy.CenterSpark:Emit(1)
  285.                        
  286.                     hit.Parent.Stunned.Value = true
  287.                     enemyHum.WalkSpeed = 0
  288.                        
  289.                     game.Debris:AddItem(Atttachy,2)
  290.                        
  291.                         local ui = StunnedGui:Clone()
  292.                         ui.Parent = hit.Parent.Head
  293.                         game.Debris:AddItem(ui,BasicStun)
  294.  
  295.  
  296.  
  297.                         CanHit = false
  298.                         hitbox:Destroy()
  299.                         wait(BasicStun)
  300.                         hit.Parent.Stunned.Value = false
  301.                         enemyHum.WalkSpeed = 16
  302.                     else
  303.                         local Hitty = BlockSound:Clone()
  304.                         Hitty.Parent = Character.HumanoidRootPart
  305.                         Hitty:Play()
  306.                         game.Debris:AddItem(Hitty,2)
  307.  
  308.                         CanHit = false
  309.                         print("Blocking")
  310.                         local enemyHum = hit.Parent:FindFirstChild("Humanoid")
  311.                        
  312.                         local HitAnimation = enemyHum:LoadAnimation(Blocked)
  313.                         HitAnimation:Play()
  314.                        
  315.                         local Atttachy = AttachmentBlock:Clone()
  316.                         Atttachy.Parent = hit.Parent.HumanoidRootPart
  317.                         Atttachy.Radial:Emit(1)
  318.                         Atttachy.CenterStar:Emit(30)   
  319.                         Atttachy.Sparks:Emit(30)   
  320.                         game.Debris:AddItem(Atttachy,2)
  321.                        
  322.                         -- Apply BodyVelocity to push the player
  323.                        
  324.                         local vel = Instance.new("BodyVelocity")
  325.                         vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  326.                         vel.Parent = hit.Parent.HumanoidRootPart
  327.                         vel.Velocity = hit.Parent.HumanoidRootPart.CFrame.LookVector * -2
  328.                         vel.Name  =  "SmallMoveVel"
  329.                         game.Debris:AddItem(vel,.7)
  330.                     end
  331.                 end
  332.             end
  333.         end)
  334.         wait(.5)
  335.         hitbox:Destroy()
  336.     end -- last end for Combo == 2
  337.    
  338.     if Combo == 3 then ---- the third Punch
  339.         CanHit = true
  340.         -- sound
  341.         local Swingy = PunchSwing:Clone()
  342.         Swingy.Parent = Character.HumanoidRootPart
  343.         Swingy:Play()
  344.         game.Debris:AddItem(Swingy,2)
  345.  
  346.         ---- animation
  347.         print("Combo Recieved")
  348.         local anim = Humanoid:LoadAnimation(Punch3)
  349.         anim:Play()
  350.  
  351.         ------- hit box instance
  352.  
  353.         local hitbox = Instance.new("Part", Character)
  354.         hitbox.Anchored = false
  355.         hitbox.CanCollide = false
  356.         hitbox.Size = Character.HumanoidRootPart.Size
  357.         hitbox.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, -2.5)
  358.         hitbox.Transparency = 1
  359.  
  360.         local hitboxWeld = Instance.new("ManualWeld")
  361.         hitboxWeld.Name = "HitboxWeld"
  362.         hitboxWeld.Part0 = hitbox
  363.         hitboxWeld.Part1 = Character.HumanoidRootPart
  364.         hitboxWeld.C0 = hitbox.CFrame:ToObjectSpace(Character.HumanoidRootPart.CFrame)
  365.         hitboxWeld.Parent = hitbox
  366.  
  367.         ---- HitBox touched
  368.  
  369.         hitbox.Touched:Connect(function(hit)           
  370.             if CanHit == false then return end
  371.            
  372.             local Parry = hit.Parent:FindFirstChild("Parry")
  373.  
  374.             if Parry.Value == true then
  375.  
  376.                 hit.Parent.Stunned.Value = true
  377.                 Humanoid.WalkSpeed = 0
  378.  
  379.                 local ui = ParryGui:Clone()
  380.                 ui.Parent = Character.Head
  381.                 game.Debris:AddItem(ui,BasicStun)
  382.  
  383.                 wait(BasicStun)
  384.                 hit.Parent.Stunned.Value = false
  385.                 Humanoid.WalkSpeed = 16
  386.  
  387.             end
  388.            
  389.             if hit.Parent:FindFirstChild("Humanoid") then
  390.                 if Parry.Value == true then return end
  391.  
  392.                 if not hit:IsDescendantOf(Character) then
  393.                     if hit.Parent.Blocking.Value == false then
  394.                         CanHit = false
  395.                         local enemyHum = hit.Parent:FindFirstChild("Humanoid")
  396.                         enemyHum:TakeDamage(BasicDamage)
  397.                         local HitAnimation = enemyHum:LoadAnimation(LeftHit)
  398.                         HitAnimation:Play()
  399.  
  400.                         local Hitty = HitSound:Clone()
  401.                         Hitty.Parent = Character.HumanoidRootPart
  402.                         Hitty:Play()
  403.                         game.Debris:AddItem(Hitty,2)
  404.  
  405.                         local Atttachy = AttachmentHit:Clone()
  406.                         Atttachy.Parent = hit.Parent.HumanoidRootPart
  407.                         Atttachy.Ring:Emit(1)
  408.                         Atttachy.Sparks:Emit(20)   
  409.                         Atttachy.Residue:Emit(20)  
  410.                         Atttachy.CenterSpark:Emit(1)
  411.                        
  412.                         hit.Parent.Stunned.Value = true
  413.                         enemyHum.WalkSpeed = 0
  414.                        
  415.                         game.Debris:AddItem(Atttachy,2)
  416.  
  417.                         local ui = StunnedGui:Clone()
  418.                         ui.Parent = hit.Parent.Head
  419.                         game.Debris:AddItem(ui,BasicStun)
  420.  
  421.  
  422.                         CanHit = false
  423.                         hitbox:Destroy()
  424.                         wait(BasicStun)
  425.                         hit.Parent.Stunned.Value = false
  426.                         enemyHum.WalkSpeed = 16
  427.                     else
  428.                         local Hitty = BlockSound:Clone()
  429.                         Hitty.Parent = Character.HumanoidRootPart
  430.                         Hitty:Play()
  431.                         game.Debris:AddItem(Hitty,2)
  432.  
  433.                         CanHit = false
  434.                         print("Blocking")
  435.                         local enemyHum = hit.Parent:FindFirstChild("Humanoid")
  436.  
  437.                         local HitAnimation = enemyHum:LoadAnimation(Blocked)
  438.                         HitAnimation:Play()
  439.  
  440.                         local Atttachy = AttachmentBlock:Clone()
  441.                         Atttachy.Parent = hit.Parent.HumanoidRootPart
  442.                         Atttachy.Radial:Emit(1)
  443.                         Atttachy.CenterStar:Emit(30)   
  444.                         Atttachy.Sparks:Emit(30)   
  445.                         game.Debris:AddItem(Atttachy,2)
  446.                        
  447.                         -- Apply BodyVelocity to push the player
  448.                         local vel = Instance.new("BodyVelocity")
  449.                         vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  450.                         vel.Parent = hit.Parent.HumanoidRootPart
  451.                         vel.Velocity = hit.Parent.HumanoidRootPart.CFrame.LookVector * -2
  452.                         vel.Name  =  "SmallMoveVel"
  453.                         game.Debris:AddItem(vel,.7)
  454.                     end
  455.                 end
  456.             end
  457.         end)
  458.         wait(.5)
  459.         hitbox:Destroy()
  460.     end -- last end for Combo == 2
  461.    
  462.     if Combo == 4 then ---- the fourth Punch
  463.         CanHit = true
  464.         -- sound
  465.         local Swingy = PunchSwing:Clone()
  466.         Swingy.Parent = Character.HumanoidRootPart
  467.         Swingy:Play()
  468.         game.Debris:AddItem(Swingy,2)
  469.  
  470.         ---- animation
  471.         print("Combo Recieved")
  472.         local anim = Humanoid:LoadAnimation(Punch4)
  473.         anim:Play()
  474.  
  475.         ------- hit box instance
  476.  
  477.         local hitbox = Instance.new("Part", Character)
  478.         hitbox.Anchored = false
  479.         hitbox.CanCollide = false
  480.         hitbox.Size = Character.HumanoidRootPart.Size
  481.         hitbox.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, -2.5)
  482.         hitbox.Transparency = 1
  483.  
  484.         local hitboxWeld = Instance.new("ManualWeld")
  485.         hitboxWeld.Name = "HitboxWeld"
  486.         hitboxWeld.Part0 = hitbox
  487.         hitboxWeld.Part1 = Character.HumanoidRootPart
  488.         hitboxWeld.C0 = hitbox.CFrame:ToObjectSpace(Character.HumanoidRootPart.CFrame)
  489.         hitboxWeld.Parent = hitbox
  490.  
  491.         ---- HitBox touched
  492.  
  493.         hitbox.Touched:Connect(function(hit)   
  494.             if CanHit == false then return end
  495.            
  496.             local Parry = hit.Parent:FindFirstChild("Parry")
  497.  
  498.             if Parry.Value == true then
  499.  
  500.                 hit.Parent.Stunned.Value = true
  501.                 Humanoid.WalkSpeed = 0
  502.  
  503.                 local ui = ParryGui:Clone()
  504.                 ui.Parent = Character.Head
  505.                 game.Debris:AddItem(ui,BasicStun)
  506.  
  507.                 wait(BasicStun)
  508.                 hit.Parent.Stunned.Value = false
  509.                 Humanoid.WalkSpeed = 16
  510.  
  511.             end
  512.            
  513.             if hit.Parent:FindFirstChild("Humanoid") then
  514.                 if Parry.Value == true then return end
  515.  
  516.                 if not hit:IsDescendantOf(Character) then
  517.                     if hit.Parent.Blocking.Value == false then
  518.                         CanHit = false
  519.                         local enemyHum = hit.Parent:FindFirstChild("Humanoid")
  520.                         enemyHum:TakeDamage(BasicDamage)
  521.                         local HitAnimation = enemyHum:LoadAnimation(RightHit)
  522.                         HitAnimation:Play()
  523.  
  524.                         local Hitty = HitSound:Clone()
  525.                         Hitty.Parent = Character.HumanoidRootPart
  526.                         Hitty:Play()
  527.                         game.Debris:AddItem(Hitty,2)
  528.                        
  529.                         hit.Parent.Stunned.Value = true
  530.                         enemyHum.WalkSpeed = 0
  531.  
  532.                         local Atttachy = AttachmentHit:Clone()
  533.                         Atttachy.Parent = hit.Parent.HumanoidRootPart
  534.                         Atttachy.Ring:Emit(1)
  535.                         Atttachy.Sparks:Emit(20)   
  536.                         Atttachy.Residue:Emit(20)  
  537.                         Atttachy.CenterSpark:Emit(1)
  538.  
  539.                         game.Debris:AddItem(Atttachy,2)
  540.  
  541.                         local ui = StunnedGui:Clone()
  542.                         ui.Parent = hit.Parent.Head
  543.                         game.Debris:AddItem(ui,BasicStun)
  544.                        
  545.                        
  546.                         CanHit = false
  547.                         hitbox:Destroy()
  548.                         wait(BasicStun)
  549.                         hit.Parent.Stunned.Value = false
  550.                         enemyHum.WalkSpeed = 16
  551.                     else
  552.                         local Hitty = BlockSound:Clone()
  553.                         Hitty.Parent = Character.HumanoidRootPart
  554.                         Hitty:Play()
  555.                         game.Debris:AddItem(Hitty,2)
  556.  
  557.                         CanHit = false
  558.                         print("Blocking")
  559.                         local enemyHum = hit.Parent:FindFirstChild("Humanoid")
  560.  
  561.                         local HitAnimation = enemyHum:LoadAnimation(Blocked)
  562.                         HitAnimation:Play()
  563.  
  564.                         local Atttachy = AttachmentBlock:Clone()
  565.                         Atttachy.Parent = hit.Parent.HumanoidRootPart
  566.                         Atttachy.Radial:Emit(1)
  567.                         Atttachy.CenterStar:Emit(30)   
  568.                         Atttachy.Sparks:Emit(30)   
  569.                         game.Debris:AddItem(Atttachy,2)
  570.                        
  571.                         -- Apply BodyVelocity to push the player
  572.                         local vel = Instance.new("BodyVelocity")
  573.                         vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  574.                         vel.Parent = hit.Parent.HumanoidRootPart
  575.                         vel.Velocity = hit.Parent.HumanoidRootPart.CFrame.LookVector * -2
  576.                         vel.Name  =  "SmallMoveVel"
  577.                         game.Debris:AddItem(vel,.7)
  578.                     end
  579.                 end
  580.             end
  581.         end)
  582.         wait(.5)
  583.         hitbox:Destroy()
  584.     end -- last end for Combo == 4
  585.    
  586.     if Combo == 5 then ---- the final Punch
  587.         CanHit = true
  588.         -- sound
  589.         local Swingy = PunchSwing:Clone()
  590.         Swingy.Parent = Character.HumanoidRootPart
  591.         Swingy:Play()
  592.         game.Debris:AddItem(Swingy,2)
  593.  
  594.         ---- animation
  595.         print("Combo Recieved")
  596.         local anim = Humanoid:LoadAnimation(Punch5)
  597.         anim:Play()
  598.  
  599.         ------- hit box instance
  600.  
  601.         local hitbox = Instance.new("Part", Character)
  602.         hitbox.Anchored = false
  603.         hitbox.CanCollide = false
  604.         hitbox.Size = Character.HumanoidRootPart.Size
  605.         hitbox.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, -2.5)
  606.         hitbox.Transparency = 1
  607.  
  608.         local hitboxWeld = Instance.new("ManualWeld")
  609.         hitboxWeld.Name = "HitboxWeld"
  610.         hitboxWeld.Part0 = hitbox
  611.         hitboxWeld.Part1 = Character.HumanoidRootPart
  612.         hitboxWeld.C0 = hitbox.CFrame:ToObjectSpace(Character.HumanoidRootPart.CFrame)
  613.         hitboxWeld.Parent = hitbox
  614.  
  615.         ---- HitBox touched
  616.  
  617.         hitbox.Touched:Connect(function(hit)
  618.             if CanHit == false then return end
  619.            
  620.             local Parry = hit.Parent:FindFirstChild("Parry")
  621.  
  622.             if Parry.Value == true then
  623.  
  624.                 hit.Parent.Stunned.Value = true
  625.                 Humanoid.WalkSpeed = 0
  626.  
  627.                 local ui = ParryGui:Clone()
  628.                 ui.Parent = Character.Head
  629.                 game.Debris:AddItem(ui,BasicStun)
  630.  
  631.                 wait(BasicStun)
  632.                 hit.Parent.Stunned.Value = false
  633.                 Humanoid.WalkSpeed = 16
  634.  
  635.             end
  636.            
  637.             if hit.Parent:FindFirstChild("Humanoid") then
  638.                 if Parry.Value == true then return end
  639.  
  640.                 if not hit:IsDescendantOf(Character) then
  641.                     if hit.Parent.Blocking.Value == false then
  642.                         CanHit = false
  643.                         local enemyHum = hit.Parent:FindFirstChild("Humanoid")
  644.                         enemyHum:TakeDamage(FinalDamage)
  645.                         local HitAnimation = enemyHum:LoadAnimation(KnockBack)
  646.                         HitAnimation:Play()
  647.                        
  648.                         local Shakes = Shake:Clone()
  649.                         Shakes.Parent = Character
  650.                         Shakes.Disabled = false
  651.                         game.Debris:AddItem(Shakes,.55)
  652.                        
  653.                         local Hitty = Heavy:Clone()
  654.                         Hitty.Parent = Character.HumanoidRootPart
  655.                         Hitty:Play()
  656.                         game.Debris:AddItem(Hitty,2)
  657.                        
  658.                         hit.Parent.Stunned.Value = true
  659.                         enemyHum.WalkSpeed = 0
  660.  
  661.                         local Atttachy = AttachmentHit:Clone()
  662.                         Atttachy.Parent = hit.Parent.HumanoidRootPart
  663.                         Atttachy.Ring:Emit(1)
  664.                         Atttachy.Sparks:Emit(20)   
  665.                         Atttachy.Residue:Emit(20)  
  666.                         Atttachy.CenterSpark:Emit(1)
  667.  
  668.                         game.Debris:AddItem(Atttachy,2)
  669.                        
  670.                         -- Calculate the direction from the character's HumanoidRootPart to the hit object's HumanoidRootPart
  671.                         local hitToCharacterDir = (Character.HumanoidRootPart.Position - hit.Parent.HumanoidRootPart.Position).unit
  672.                        
  673.                         -- Apply BodyVelocity to push the player
  674.                         local bv = Instance.new("BodyVelocity",hit.Parent.HumanoidRootPart)
  675.                         bv.MaxForce = Vector3.new(1e8,1e8,1e8)
  676.                         bv.Velocity = hitToCharacterDir * -20 + Vector3.new(0, 2, 0)
  677.                         game.Debris:AddItem(bv,0.3)
  678.                        
  679.                         wait(FinalStun)
  680.                         hit.Parent.Stunned.Value = false
  681.                         enemyHum.WalkSpeed = 16
  682.                        
  683.  
  684.  
  685.                         CanHit = false
  686.                         hitbox:Destroy()
  687.                     else
  688.                         local enemyHum = hit.Parent:FindFirstChild("Humanoid")
  689.                         local Hitty = BlockBreakSound:Clone()
  690.                         Hitty.Parent = Character.HumanoidRootPart
  691.                         Hitty:Play()
  692.                         game.Debris:AddItem(Hitty,2)
  693.                        
  694.                         -- Retrieve the targeted player's aiming status and stop the animation if they are blocking.
  695.                         local animationTracks = enemyHum:GetPlayingAnimationTracks()
  696.  
  697.                         for _, track in pairs(animationTracks) do
  698.                             if track.Animation.AnimationId == blockAnimationId then
  699.                                 track:Stop()
  700.                                 print("Block Anim SuccessFull Stopped")
  701.                             end
  702.                         end
  703.                        
  704.                         hit.Parent.Blocking.Value = false
  705.                         hit.Parent.Stunned.Value = true
  706.                         CanHit = false
  707.                         print("Block Break")
  708.                        
  709.                         local ui = StunnedGui:Clone()
  710.                         ui.Parent = hit.Parent.Head
  711.                         game.Debris:AddItem(ui,3)
  712.                        
  713.                         local enemyHum = hit.Parent:FindFirstChild("Humanoid")
  714.  
  715.                         local HitAnimation = enemyHum:LoadAnimation(Break)
  716.                         HitAnimation:Play()
  717.  
  718.                         local Atttachy = AttachmentBreak:Clone()
  719.                         Atttachy.Parent = hit.Parent.HumanoidRootPart
  720.                         Atttachy.Radial:Emit(1)
  721.                         Atttachy.CenterPiece:Emit(3)   
  722.                         Atttachy.Sparks:Emit(30)   
  723.                         Atttachy.Crack:Emit(1)
  724.                         game.Debris:AddItem(Atttachy,2)
  725.                        
  726.                         -- Calculate the direction from the character's HumanoidRootPart to the hit object's HumanoidRootPart
  727.                         local hitToCharacterDir = (Character.HumanoidRootPart.Position - hit.Parent.HumanoidRootPart.Position).unit                    
  728.                        
  729.                         -- Apply BodyVelocity to push the player
  730.                         local bv = Instance.new("BodyVelocity",hit.Parent.HumanoidRootPart)
  731.                         bv.MaxForce = Vector3.new(1e8,1e8,1e8)
  732.                         bv.Velocity = hitToCharacterDir * -15 + Vector3.new(0, 2, 0)
  733.                         game.Debris:AddItem(bv,0.3)
  734.                        
  735.                         wait(3)
  736.                         hit.Parent.Stunned.Value = false
  737.                     end
  738.                 end
  739.             end
  740.         end)
  741.         wait(.5)
  742.         hitbox:Destroy()
  743.     end -- last end for Combo == 5
  744.    
  745. end)
  746.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement