Advertisement
Guest User

Untitled

a guest
Jan 10th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.87 KB | None | 0 0
  1. local tool = script.Parent
  2. local player = script.Parent.Parent.Parent
  3. local Character = player.Character or player.CharacterAdded:Wait()
  4. local RegionModule = require(game.ReplicatedStorage.RegionModule)
  5. local humanoid = Character:WaitForChild("Humanoid")
  6. repeat wait() until humanoid
  7.  
  8. local repstorage = game:GetService("ReplicatedStorage")
  9. local debris = game:GetService("Debris")
  10. local combo = 0
  11. local cd = false
  12. local lasthit = 0
  13. local Damage = 2
  14. local BodyToughness = 0
  15. local touchedpart = false
  16. local alreadytouchedpart = false
  17.  
  18. local ReplicatedStorage = game.ReplicatedStorage
  19. local Shake = ReplicatedStorage.Effects.ShakeScript
  20. local Rush = ReplicatedStorage.Gui.RushEffect
  21.  
  22. local function findFirstCharacterInRegion(partsList)
  23.     for _, part in next, partsList do
  24.         if part.Parent and part.Parent:FindFirstChild"Humanoid" then
  25.             return part.Parent
  26.         end
  27.     end
  28. end
  29.  
  30. local function touched(hit)
  31.  
  32. end
  33.  
  34. function Explode()
  35.  
  36. end
  37.  
  38. tool.Activated:Connect(function()
  39.  
  40.         local velocity = Character.HumanoidRootPart.Velocity
  41.         local unit = velocity.magnitude > 0 and velocity.unit or Vector3.new(0, 0, 0)
  42.         local dot = unit:Dot(Character.HumanoidRootPart.CFrame.lookVector)
  43.         local dot2 = Character.HumanoidRootPart.CFrame.rightVector:Dot(unit)
  44.  
  45.         local cf = Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -2.5)
  46.         if math.abs(dot) > 0 then
  47.             if math.floor(dot + 0.5) == 1 then
  48.                 cf = cf + Character.HumanoidRootPart.CFrame.lookVector * 4.5
  49.             elseif math.floor(dot + 0.5) == -1 then
  50.                 cf = cf + Character.HumanoidRootPart.CFrame.lookVector * -3
  51.             end
  52.         end
  53.         if math.abs(dot2) > 0 then
  54.             if math.floor(dot2 + 0.5) == 1 then
  55.                 cf = cf + Character.HumanoidRootPart.CFrame.rightVector * 4.5
  56.             elseif math.floor(dot2 + 0.5) == -1 then
  57.                 cf = cf + Character.HumanoidRootPart.CFrame.rightVector * -3
  58.             end
  59.         end
  60.  
  61.         local region = RegionModule.new(cf, Vector3.new(5.5, 5, 5.5))
  62.  
  63.  
  64.         hitCharacter = findFirstCharacterInRegion(region:Cast(Character))
  65.  
  66.  
  67.  
  68.  
  69.  
  70.         if cd == true then return end
  71.         cd = true
  72.         if tick() - lasthit < .3 then
  73.             combo = combo + 1
  74.             print(combo)
  75.         else
  76.             combo = 1
  77.         end
  78.  
  79.         lasthit = tick() + .8
  80.  
  81.         local animsplay = humanoid:LoadAnimation(tool["Punch"..(combo)])
  82.  
  83.         animsplay:Play()
  84.  
  85.         if hitCharacter then
  86.  
  87.  
  88.             local hitPlayer = game.Players:GetPlayerFromCharacter(hitCharacter)
  89.  
  90.             local Effects = repstorage.Effects["Combat"].testing12:Clone()
  91.  
  92.             hitCharacter:FindFirstChild("Humanoid"):TakeDamage(Damage - BodyToughness)
  93.  
  94.             if hitPlayer then
  95.                 local Swag = Effects
  96.                 debris:AddItem(Swag, 2)
  97.                 Swag.Parent = hitCharacter.UpperTorso
  98.                 Swag.CFrame = hitCharacter:FindFirstChild("UpperTorso").CFrame
  99.                 Swag.Anchored = true
  100.  
  101.  
  102.                 local Huh = Shake:Clone()
  103.                 debris:AddItem(Huh, 2)
  104.                 Huh.Parent = hitCharacter
  105.                 Huh.Disabled = false
  106.  
  107.                 local Huh2 = Rush:Clone()
  108.                 debris:AddItem(Huh2, 2)
  109.                 Huh2.Parent = hitPlayer.PlayerGui
  110.                 Huh2.Image.LocalScript.Disabled = false
  111.             end
  112.         end
  113.  
  114.  
  115.         if hitCharacter and combo == 5 then
  116.             local knockedback = Instance.new("Folder")
  117.             debris:AddItem(knockedback, 2)
  118.             knockedback.Parent = hitCharacter.Humanoid
  119.             knockedback.Name = "Knockedback"
  120.             local bvenemy = Instance.new("BodyVelocity")
  121.             bvenemy.MaxForce = Vector3.new(1e7, 1e7, 1e7)
  122.             bvenemy.Velocity = Character.HumanoidRootPart.CFrame.lookVector * 45 + Vector3.new(0,12,0)
  123.             debris:AddItem(bvenemy, .65)
  124.             bvenemy.Parent = hitCharacter.HumanoidRootPart
  125.             local stun = hitCharacter.Humanoid:LoadAnimation(tool["Stun"..math.random(1,2)])
  126.             stun:Play()
  127.         end
  128.  
  129.  
  130.  
  131.  
  132.  
  133.         if combo == 5 then
  134.             combo = 1
  135.             alreadytouchedpart = false
  136.  
  137.             if hitCharacter and hitCharacter.Humanoid.Knockedback then
  138.  
  139.                 hitCharacter.Humanoid.Touched:Connect(function(hitPart)
  140.                     if touchedpart == true then return end
  141.                     if alreadytouchedpart == true then return end
  142.                     if hitPart.CanCollide == false then return end
  143.  
  144.                     if hitPart then
  145.                         wait(.2)
  146.                         if hitCharacter == nil then return end
  147.  
  148.                         touchedpart = true
  149.  
  150.                         local BOOM = ReplicatedStorage.Items.Explosion:Clone()
  151.                         debris:AddItem(BOOM, 5)
  152.                         BOOM.Parent = workspace
  153.                         BOOM.CFrame = hitCharacter.HumanoidRootPart.CFrame
  154.                         BOOM.Script.Disabled = false
  155.  
  156.                         local TrailColors = {hitPart.Color}
  157.  
  158.                         local function Trails()
  159.                             local TrailPart = Instance.new("Part")
  160.                             local bv = Instance.new("BodyVelocity", TrailPart)
  161.                             bv.MaxForce = Vector3.new(1e8,1e5, 1e8)
  162.                             bv.Velocity = Vector3.new(math.random(-80,80),math.random(20,60),math.random(-80,80))
  163.                             debris:AddItem(bv, .45)
  164.                             TrailPart.Name = "TrailPart"
  165.                             TrailPart.Material = "Slate"
  166.                             TrailPart.Color = Color3.new(hitPart.Color)
  167.                             TrailPart.Transparency = 0
  168.                             TrailPart.Anchored = false
  169.                             TrailPart.CanCollide = false
  170.                             TrailPart.FormFactor = "Custom"
  171.                             TrailPart.Size = Vector3.new(3.5,3.5,3.5)
  172.                             TrailPart.Parent = game.Workspace
  173.                             TrailPart.CFrame = hitCharacter.HumanoidRootPart.CFrame
  174.  
  175.                         end
  176.                         Trails()
  177.                         Trails()
  178.                         Trails()
  179.                         Trails()
  180.                         Trails()
  181.                         Trails()
  182.                         Trails()
  183.                         Trails()
  184.                         Trails()
  185.                         Trails()
  186.                         alreadytouchedpart = true
  187.                         touchedpart = false
  188.                     else
  189.                         print"nochars"
  190.                     end
  191.                 end)
  192.             end
  193.         end
  194.  
  195.  
  196.         if combo == 4 then
  197.             wait(.3)
  198.         end
  199.  
  200.         wait(.38)
  201.         cd = false
  202. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement