daily pastebin goal
40%
SHARE
TWEET

Untitled

a guest Jan 11th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local Tool = script.Parent
  2. local Player = script.Parent.Parent.Parent
  3. local Character = Player.Character or Player.CharacterAdded:Wait()
  4. local Humanoid = Character:WaitForChild("Humanoid")
  5. repeat wait() until Humanoid
  6.  
  7. local RS = game:GetService("ReplicatedStorage")
  8. local Debris = game:GetService("Debris")
  9. local TWEEN = game:GetService("TweenService")
  10. local Combo = 0
  11. local CD = false
  12. local LastHit = 0
  13. local Damage = 2
  14. local BodyToughness = 0 -- Not used for now
  15.  
  16. local Shake = RS.Effects.ShakeScript
  17. local Rush = RS.Gui.RushEffect
  18.  
  19. local RegionModule = require(game.ReplicatedStorage.RegionModule)
  20.  
  21. local function findFirstCharacterInRegion(partsList)
  22.     for _, part in next, partsList do
  23.         if part.Parent and part.Parent:FindFirstChild"Humanoid" then
  24.             return part.Parent
  25.         end
  26.     end
  27. end
  28.  
  29.     local function createRay(startPos, direction, distance, ignore)
  30.         local ray = Ray.new(startPos, direction.unit * distance)
  31.         local hitPart, hitPosition, normal, material = workspace:FindPartOnRayWithIgnoreList(ray, ignore)
  32.         return hitPart, hitPosition, normal, material
  33.         end
  34.  
  35. Tool.Activated:Connect(function()
  36.  
  37.     local Velocity = Character.HumanoidRootPart.Velocity
  38.     local Unit = Velocity.magnitude > 0 and Velocity.unit or Vector3.new(0, 0, 0)
  39.     local Dot = Unit:Dot(Character.HumanoidRootPart.CFrame.lookVector)
  40.     local Dot2 = Character.HumanoidRootPart.CFrame.rightVector:Dot(Unit)
  41.     local CF = Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -2.5)
  42.  
  43.     if math.abs(Dot) > 0 then
  44.         if math.floor(Dot + 0.5) == 1 then
  45.             CF = CF + Character.HumanoidRootPart.CFrame.lookVector * 4.5
  46.         elseif math.floor(Dot + 0.5) == -1 then
  47.             CF = CF + Character.HumanoidRootPart.CFrame.lookVector * -3
  48.         end
  49.     end
  50.  
  51.  
  52.     local Region = RegionModule.new(CF, Vector3.new(5.5, 5, 5.5))
  53.  
  54.     local hitCharacter = findFirstCharacterInRegion(Region:Cast(Character))
  55.  
  56.     if CD == true then return end
  57.     CD = true
  58.     if tick() - LastHit < .3 then
  59.         Combo = Combo + 1
  60.         print(Combo)
  61.     else
  62.         Combo = 1
  63.     end
  64.    
  65.     LastHit = tick() + .8
  66.  
  67.     local AnimPlay = Humanoid:LoadAnimation(Tool["Punch"..(Combo)])
  68.  
  69.     AnimPlay:Play()
  70.  
  71.     if hitCharacter then
  72.  
  73.     local hitPlayer = game.Players:GetPlayerFromCharacter(hitCharacter)
  74.                
  75.     local Effects = RS.Effects["Combat"].CombatEffect:Clone()
  76.  
  77.     hitCharacter:FindFirstChild("Humanoid"):TakeDamage(Damage - BodyToughness)
  78.  
  79.     if hitPlayer then
  80.         local Swag = Effects
  81.             Debris:AddItem(Swag, 2)
  82.             Swag.Parent = hitCharacter.UpperTorso
  83.             Swag.CFrame = hitCharacter:FindFirstChild("UpperTorso").CFrame
  84.             Swag.Anchored = true
  85.             --[==[
  86.             local weld = Instance.new("Weld", Swag)
  87.             weld.Part0 = Swag
  88.             weld.Part1 = hitCharacter.UpperTorso]==]
  89.         local Huh = Shake:Clone()
  90.             Debris:AddItem(Huh, 2)
  91.             Huh.Parent = hitCharacter
  92.             Huh.Disabled = false
  93.  
  94.         local Huh2 = Rush:Clone()
  95.             Debris:AddItem(Huh2, 2)
  96.             Huh2.Parent = hitPlayer.PlayerGui
  97.             Huh2.Image.LocalScript.Disabled = false
  98.         end
  99.     end
  100.  
  101.     if hitCharacter and Combo == 5 then
  102.         local KnockedBack = Instance.new("Folder")
  103.             Debris:AddItem(KnockedBack, 2)
  104.             KnockedBack.Parent = hitCharacter.Humanoid
  105.             KnockedBack.Name = "Knockedback"
  106.         --[==[local BVEnemy = Instance.new("BodyVelocity")
  107.             BVEnemy.MaxForce = Vector3.new(1e7, 1e7, 1e7)
  108.             BVEnemy.Velocity = Character.HumanoidRootPart.CFrame.lookVector * 45 + Vector3.new(0,12,0)
  109.             Debris:AddItem(BVEnemy, .65)
  110.             BVEnemy.Parent = hitCharacter.HumanoidRootPart]==]
  111.         local Stun = hitCharacter.Humanoid:LoadAnimation(Tool["Stun"..math.random(1,2)])
  112.             Stun:Play()
  113.     end
  114.                        
  115.     if Combo == 5 then
  116.     Combo = 1
  117.     if hitCharacter and hitCharacter.Humanoid.Knockedback then
  118.  
  119.    
  120.  
  121.         local hitPart, hitPosition = createRay(Character.HumanoidRootPart.Position, Character.HumanoidRootPart.Position, 20, {workspace.Characters})
  122.         local distance = (hitCharacter.HumanoidRootPart.Position - hitPosition).magnitude
  123.         local tween = TWEEN:Create(hitCharacter.HumanoidRootPart, TweenInfo.new(distance/40, Enum.EasingStyle.Linear), {Position = hitPosition})
  124.        
  125.         tween:Play()
  126.         tween.Completed:Connect(function()
  127.             if hitPart then
  128.                 print("hirayworked")
  129.             end
  130.         end)
  131.  
  132.     hitCharacter.Humanoid.Touched:Connect(function(hitPart)
  133.        
  134.         if hitPart:FindFirstChild("UpperTorso") then
  135.            
  136.            
  137.            
  138.         end
  139.             end)
  140.         end
  141.     end
  142.    
  143.     if Combo == 4 then
  144.             wait(.3)
  145.         end
  146.     wait(.38)
  147.     CD = false
  148.     end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top