Advertisement
Mz_TH_edit

Untitled

May 21st, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.70 KB | None | 0 0
  1. --[[FindNearestTorso = function(pos)
  2.     local list = (game.Workspace:children())
  3.     local torso = nil
  4.     local dist = 1000
  5.     local temp, human, temp2 = nil, nil, nil
  6.     for x = 1, #list do
  7.         temp2 = list[x]
  8.         if temp2.className == "Model" and temp2.Name ~= Character.Name then
  9.             temp = temp2:findFirstChild("Torso")
  10.             human = temp2:findFirstChild("Humanoid")
  11.             if temp ~= nil and human ~= nil and human.Health > 0 and (temp.Position - pos).magnitude < dist then
  12.                 local dohit = true
  13.                 if dohit == true then
  14.                     torso = temp
  15.                     dist = (temp.Position - pos).magnitude
  16.                 end
  17.             end
  18.         end
  19.     end
  20.     return torso, dist
  21. end]]
  22. function FindNearestTorso(Position, Distance, SinglePlayer)
  23.     if SinglePlayer then
  24.         return (SinglePlayer.Torso.CFrame.p - Position).magnitude < Distance
  25.     end
  26.     local List = {}
  27.     for i, v in pairs(workspace:GetChildren()) do
  28.         if v:IsA("Model") then
  29.             if v:findFirstChild("Torso") then
  30.                 if v ~= Character then
  31.                     if (v.Torso.Position - Position).magnitude <= Distance then
  32.                         table.insert(List, v)
  33.                     end
  34.                 end
  35.             end
  36.         end
  37.     end
  38.     return List
  39. end
  40. function Damage(Part, hit, minim, maxim, knockback, Type, Property, Delay, HitSound, HitPitch)
  41.     if hit.Parent == nil then
  42.         return
  43.     end
  44.     local h = hit.Parent:FindFirstChild("Humanoid")
  45.     for _, v in pairs(hit.Parent:children()) do
  46.         if v:IsA("Humanoid") then
  47.             h = v
  48.         end
  49.     end
  50.     if h ~= nil and hit.Parent.Name ~= Character.Name and hit.Parent:FindFirstChild("Torso") ~= nil then
  51.         if hit.Parent:findFirstChild("DebounceHit") ~= nil then
  52.             if hit.Parent.DebounceHit.Value == true then
  53.                 return
  54.             end
  55.         end
  56.         local c = Create("ObjectValue"){
  57.             Name = "creator",
  58.             Value = game:service("Players").LocalPlayer,
  59.             Parent = h,
  60.         }
  61.         game:GetService("Debris"):AddItem(c, .5)
  62.         if HitSound ~= nil and HitPitch ~= nil then
  63.             CFuncs.Sound.Create(HitSound, hit, 1, HitPitch)
  64.         end
  65.         local Damage = math.random(minim, maxim)
  66.         local blocked = false
  67.         local block = hit.Parent:findFirstChild("Block")
  68.         if block ~= nil then
  69.             if block.className == "IntValue" then
  70.                 if block.Value > 0 then
  71.                     blocked = true
  72.                     block.Value = block.Value - 1
  73.                     print(block.Value)
  74.                 end
  75.             end
  76.         end
  77.         if blocked == false then
  78.             h.Health = h.Health - Damage
  79.             ShowDamage((Part.CFrame * CFrame.new(0, 0, (Part.Size.Z / 2)).p + Vector3.new(0, 1.5, 0)), -Damage, 1.5, BrickColor.new("Really black").Color)
  80.         else
  81.             h.Health = h.Health - (Damage / 2)
  82.             ShowDamage((Part.CFrame * CFrame.new(0, 0, (Part.Size.Z / 2)).p + Vector3.new(0, 1.5, 0)), -Damage, 1.5, BrickColor.new("Really black").Color)
  83.         end
  84.         if Type == "Knockdown" then
  85.             local hum = hit.Parent.Humanoid
  86.             hum.PlatformStand = true
  87.             coroutine.resume(coroutine.create(function(HHumanoid)
  88.                 swait(1)
  89.                 HHumanoid.PlatformStand = false
  90.             end), hum)
  91.             local angle = (hit.Position - (Property.Position + Vector3.new(0, 0, 0))).unit
  92.             local bodvol = Create("BodyVelocity"){
  93.                 velocity = angle * knockback,
  94.                 P = 5000,
  95.                 maxForce = Vector3.new(8e+003, 8e+003, 8e+003),
  96.                 Parent = hit,
  97.             }
  98.             local rl = Create("BodyAngularVelocity"){
  99.                 P = 3000,
  100.                 maxTorque = Vector3.new(500000, 500000, 500000) * 50000000000000,
  101.                 angularvelocity = Vector3.new(math.random(-10, 10), math.random(-10, 10), math.random(-10, 10)),
  102.                 Parent = hit,
  103.             }
  104.             game:GetService("Debris"):AddItem(bodvol, .5)
  105.             game:GetService("Debris"):AddItem(rl, .5)
  106.         elseif Type == "Normal" then
  107.             local vp = Create("BodyVelocity"){
  108.                 P = 500,
  109.                 maxForce = Vector3.new(math.huge, 0, math.huge),
  110.                 velocity = Property.CFrame.lookVector * knockback + Property.Velocity / 1.05,
  111.             }
  112.             if knockback > 0 then
  113.                 vp.Parent = hit.Parent.Torso
  114.             end
  115.             game:GetService("Debris"):AddItem(vp, .5)
  116.         elseif Type == "Up" then
  117.             local bodyVelocity = Create("BodyVelocity"){
  118.                 velocity = Vector3.new(0, 20, 0),
  119.                 P = 5000,
  120.                 maxForce = Vector3.new(8e+003, 8e+003, 8e+003),
  121.                 Parent = hit,
  122.             }
  123.             game:GetService("Debris"):AddItem(bodyVelocity, .5)
  124.         elseif Type == "DarkUp" then
  125.             coroutine.resume(coroutine.create(function()
  126.                 for i = 0, 1, 0.1 do
  127.                     swait()
  128.                     Effects.Block.Create(BrickColor.new("Black"), hit.Parent.Torso.CFrame, 5, 5, 5, 1, 1, 1, .08, 1)
  129.                 end
  130.             end))
  131.             local bodyVelocity = Create("BodyVelocity"){
  132.                 velocity = Vector3.new(0, 20, 0),
  133.                 P = 5000,
  134.                 maxForce = Vector3.new(8e+003, 8e+003, 8e+003),
  135.                 Parent = hit,
  136.             }
  137.             game:GetService("Debris"):AddItem(bodyVelocity, 1)
  138.         elseif Type == "Snare" then
  139.             local bp = Create("BodyPosition"){
  140.                 P = 2000,
  141.                 D = 100,
  142.                 maxForce = Vector3.new(math.huge, math.huge, math.huge),
  143.                 position = hit.Parent.Torso.Position,
  144.                 Parent = hit.Parent.Torso,
  145.             }
  146.             game:GetService("Debris"):AddItem(bp, 1)
  147.         elseif Type == "Freeze" then
  148.             local BodPos = Create("BodyPosition"){
  149.                 P = 50000,
  150.                 D = 1000,
  151.                 maxForce = Vector3.new(math.huge, math.huge, math.huge),
  152.                 position = hit.Parent.Torso.Position,
  153.                 Parent = hit.Parent.Torso,
  154.             }
  155.             local BodGy = Create("BodyGyro") {
  156.                 maxTorque = Vector3.new(4e+005, 4e+005, 4e+005) * math.huge ,
  157.                 P = 20e+003,
  158.                 Parent = hit.Parent.Torso,
  159.                 cframe = hit.Parent.Torso.CFrame,
  160.             }
  161.             hit.Parent.Torso.Anchored = true
  162.             coroutine.resume(coroutine.create(function(Part)
  163.                 swait(1.5)
  164.                 Part.Anchored = false
  165.             end), hit.Parent.Torso)
  166.             game:GetService("Debris"):AddItem(BodPos, 3)
  167.             game:GetService("Debris"):AddItem(BodGy, 3)
  168.         end
  169.         local debounce = Create("BoolValue"){
  170.             Name = "DebounceHit",
  171.             Parent = hit.Parent,
  172.             Value = true,
  173.         }
  174.         game:GetService("Debris"):AddItem(debounce, Delay)
  175.         c = Create("ObjectValue"){
  176.             Name = "creator",
  177.             Value = Player,
  178.             Parent = h,
  179.         }
  180.         game:GetService("Debris"):AddItem(c, .5)
  181.     end
  182. end
  183.  
  184. function ShowDamage(Pos, Text, Time, Color)
  185.     local Rate = (1 / 30)
  186.     local Pos = (Pos or Vector3.new(0, 0, 0))
  187.     local Text = (Text or "")
  188.     local Time = (Time or 2)
  189.     local Color = (Color or Color3.new(1, 0, 1))
  190.     local EffectPart = CFuncs.Part.Create(workspace, "SmoothPlastic", 0, 1, BrickColor.new(Color), "Effect", Vector3.new(0, 0, 0))
  191.     EffectPart.Anchored = true
  192.     local BillboardGui = Create("BillboardGui"){
  193.         Size = UDim2.new(3, 0, 3, 0),
  194.         Adornee = EffectPart,
  195.         Parent = EffectPart,
  196.     }
  197.     local TextLabel = Create("TextLabel"){
  198.         BackgroundTransparency = 1,
  199.         Size = UDim2.new(1, 0, 1, 0),
  200.         Text = Text,
  201.         Font = "SciFi",
  202.         TextColor3 = Color,
  203.         TextScaled = true,
  204.         Parent = oof,
  205.     }
  206.     game.Debris:AddItem(EffectPart, (Time))
  207.     EffectPart.Parent = game:GetService("Workspace")
  208.     delay(0, function()
  209.         local Frames = (Time / Rate)
  210.         for Frame = 1, Frames do
  211.             wait(Rate)
  212.             local Percent = (Frame / Frames)
  213.             EffectPart.CFrame = CFrame.new(Pos) + Vector3.new(0, Percent, 0)
  214.             TextLabel.TextTransparency = Percent
  215.         end
  216.         if EffectPart and EffectPart.Parent then
  217.             EffectPart:Destroy()
  218.         end
  219.     end)
  220. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement