Advertisement
Guest User

Multiple Damage Script with Visuals

a guest
Jan 17th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.62 KB | None | 0 0
  1. local can = true
  2.  
  3. script.Parent.Touched:Connect(function(hit)
  4.     damage(hit)
  5. end)
  6.  
  7. function damage(hit)
  8.     if hit.Parent:FindFirstChild("Humanoid") then
  9.         if hit.Parent.Name ~= script.Parent.Parent.Name and hit.Name ~= "DMGPart" then
  10.             if hit.Parent.Humanoid.Health ~= 0 then
  11.             if can then
  12.                 local vect = hit.Parent.HumanoidRootPart.Position + hit.Parent.HumanoidRootPart.CFrame.LookVector * 5
  13.                 local lookAt = hit.Parent.HumanoidRootPart.Position
  14.                 script.Parent.Del:Destroy()
  15.                 script.Parent.Parent.HumanoidRootPart.CFrame = CFrame.new(vect, lookAt)
  16.                 script.Parent.Parent.HumanoidRootPart.Anchored = true
  17.                 print("God 1")
  18.                 if hit.Parent.Humanoid.Health ~= 0 then
  19.                 can = false
  20.                 ani = hit.Parent.Humanoid:LoadAnimation(script.Animation)
  21.                 ani:Play()
  22.                 local dsbl = game.ReplicatedStorage.Disabler:Clone()
  23.                 dsbl.Parent = hit.Parent
  24.                 ani2 = script.Parent.Parent.Humanoid:LoadAnimation(script.One)
  25.                 ani2:Play()
  26.                 hit.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
  27.                 local exp = game.ReplicatedStorage.GodRadius.First.DMGPart:Clone()
  28.                 exp.Parent = workspace
  29.                 exp.Position = hit.Parent.HumanoidRootPart.Position
  30.                 exp.Sound:Play()
  31.                 hit.Parent.HumanoidRootPart.Anchored = true
  32.                 if hit.Parent.Humanoid:FindFirstChild("creator") then
  33.                     hit.Parent.Humanoid.creator:Destroy()
  34.                     local cr = Instance.new("ObjectValue")
  35.                     cr.Name = "creator"
  36.                     cr.Value = script.cr.Value
  37.                     cr.Parent = hit.Parent.Humanoid
  38.                     game.Debris:AddItem(cr,1) --0.1
  39.                 else
  40.                     local cr = Instance.new("ObjectValue")
  41.                     cr.Name = "creator"
  42.                     cr.Value = script.cr.Value
  43.                     cr.Parent = hit.Parent.Humanoid
  44.                     game.Debris:AddItem(cr,1) --0.1
  45.                 end
  46.                 hit.Parent.Humanoid:TakeDamage(script.DMG1.Value)
  47.                 end
  48.                 wait(0.5)
  49.                 if hit.Parent.Humanoid.Health == 0 then
  50.                     hit.Parent.HumanoidRootPart.Anchored = false
  51.                     script.Parent.Parent.HumanoidRootPart.Anchored = false
  52.                 else
  53.                 print("God 2")
  54.                 ani:Play()
  55.                 ani2:Play()
  56.                 local dsbl = game.ReplicatedStorage.Disabler:Clone()
  57.                 dsbl.Parent = hit.Parent
  58.                 hit.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
  59.                 local exp2 = game.ReplicatedStorage.GodRadius.Second.DMGPart:Clone()
  60.                 exp2.Parent = workspace
  61.                 exp2.Position = hit.Parent.HumanoidRootPart.Position
  62.                 exp2.Sound:Play()
  63.                 hit.Parent.HumanoidRootPart.Anchored = true
  64.                 if hit.Parent.Humanoid:FindFirstChild("creator") then
  65.                     hit.Parent.Humanoid.creator:Destroy()
  66.                     local cr = Instance.new("ObjectValue")
  67.                     cr.Name = "creator"
  68.                     cr.Value = script.cr.Value
  69.                     cr.Parent = hit.Parent.Humanoid
  70.                     game.Debris:AddItem(cr,1) --0.1
  71.                 else
  72.                     local cr = Instance.new("ObjectValue")
  73.                     cr.Name = "creator"
  74.                     cr.Value = script.cr.Value
  75.                     cr.Parent = hit.Parent.Humanoid
  76.                     game.Debris:AddItem(cr,1) --0.1
  77.                 end
  78.                 hit.Parent.Humanoid:TakeDamage(script.DMG2.Value)
  79.                 end
  80.                 wait(0.5)
  81.                 if hit.Parent.Humanoid.Health == 0 then
  82.                     hit.Parent.HumanoidRootPart.Anchored = false
  83.                     script.Parent.Parent.HumanoidRootPart.Anchored = false
  84.                 else
  85.                 print("God 3")
  86.                 ani:Play()
  87.                 ani2:Play()
  88.                 local dsbl = game.ReplicatedStorage.Disabler:Clone()
  89.                 dsbl.Parent = hit.Parent
  90.                 hit.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
  91.                 local exp3 = game.ReplicatedStorage.GodRadius.First.DMGPart:Clone()
  92.                 exp3.Parent = workspace
  93.                 exp3.Position = hit.Parent.HumanoidRootPart.Position
  94.                 exp3.Sound:Play()
  95.                 hit.Parent.HumanoidRootPart.Anchored = true
  96.                 if hit.Parent.Humanoid:FindFirstChild("creator") then
  97.                     hit.Parent.Humanoid.creator:Destroy()
  98.                     local cr = Instance.new("ObjectValue")
  99.                     cr.Name = "creator"
  100.                     cr.Value = script.cr.Value
  101.                     cr.Parent = hit.Parent.Humanoid
  102.                     game.Debris:AddItem(cr,1) --0.1
  103.                 else
  104.                     local cr = Instance.new("ObjectValue")
  105.                     cr.Name = "creator"
  106.                     cr.Value = script.cr.Value
  107.                     cr.Parent = hit.Parent.Humanoid
  108.                     game.Debris:AddItem(cr,1) --0.1
  109.                 end
  110.                 hit.Parent.Humanoid:TakeDamage(script.DMG1.Value)
  111.                 end
  112.                 wait(0.5)
  113.                 if hit.Parent.Humanoid.Health == 0 then
  114.                     hit.Parent.HumanoidRootPart.Anchored = false
  115.                     script.Parent.Parent.HumanoidRootPart.Anchored = false
  116.                 else
  117.                 print("God 2")
  118.                 ani:Play()
  119.                 local dsbl = game.ReplicatedStorage.Disabler:Clone()
  120.                 dsbl.Parent = hit.Parent
  121.                 ani2:Play()
  122.                 hit.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
  123.                 local exp2 = game.ReplicatedStorage.GodRadius.Second.DMGPart:Clone()
  124.                 exp2.Parent = workspace
  125.                 exp2.Position = hit.Parent.HumanoidRootPart.Position
  126.                 exp2.Sound:Play()
  127.                 hit.Parent.HumanoidRootPart.Anchored = true
  128.                 if hit.Parent.Humanoid:FindFirstChild("creator") then
  129.                     hit.Parent.Humanoid.creator:Destroy()
  130.                     local cr = Instance.new("ObjectValue")
  131.                     cr.Name = "creator"
  132.                     cr.Value = script.cr.Value
  133.                     cr.Parent = hit.Parent.Humanoid
  134.                     game.Debris:AddItem(cr,1) --0.1
  135.                 else
  136.                     local cr = Instance.new("ObjectValue")
  137.                     cr.Name = "creator"
  138.                     cr.Value = script.cr.Value
  139.                     cr.Parent = hit.Parent.Humanoid
  140.                     game.Debris:AddItem(cr,1) --0.1
  141.                 end
  142.                 hit.Parent.Humanoid:TakeDamage(script.DMG2.Value)
  143.                 end
  144.                 wait(0.5)
  145.                 if hit.Parent.Humanoid.Health == 0 then
  146.                     hit.Parent.HumanoidRootPart.Anchored = false
  147.                     script.Parent.Parent.HumanoidRootPart.Anchored = false
  148.                 else
  149.                 print("God 3")
  150.                 ani:Play()
  151.                 ani2:Play()
  152.                 local dsbl = game.ReplicatedStorage.Disabler:Clone()
  153.                 dsbl.Parent = hit.Parent
  154.                 hit.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
  155.                 local exp3 = game.ReplicatedStorage.GodRadius.First.DMGPart:Clone()
  156.                 exp3.Parent = workspace
  157.                 exp3.Position = hit.Parent.HumanoidRootPart.Position
  158.                 exp3.Sound:Play()
  159.                 hit.Parent.HumanoidRootPart.Anchored = true
  160.                 if hit.Parent.Humanoid:FindFirstChild("creator") then
  161.                     hit.Parent.Humanoid.creator:Destroy()
  162.                     local cr = Instance.new("ObjectValue")
  163.                     cr.Name = "creator"
  164.                     cr.Value = script.cr.Value
  165.                     cr.Parent = hit.Parent.Humanoid
  166.                     game.Debris:AddItem(cr,1) --0.1
  167.                 else
  168.                     local cr = Instance.new("ObjectValue")
  169.                     cr.Name = "creator"
  170.                     cr.Value = script.cr.Value
  171.                     cr.Parent = hit.Parent.Humanoid
  172.                     game.Debris:AddItem(cr,1) --0.1
  173.                 end
  174.                 hit.Parent.Humanoid:TakeDamage(script.DMG1.Value)
  175.                 end
  176.                 wait(0.5)
  177.                 local dsbl = game.ReplicatedStorage.Disabler:Clone()
  178.                 dsbl.Parent = hit.Parent
  179.                 script.Parent.Parent.HumanoidRootPart.Anchored = false
  180.                 hit.Parent.HumanoidRootPart.Anchored = false
  181.                 wait()
  182.                 script.Parent:Destroy()
  183.                 end
  184.             end
  185.         end
  186.     end
  187. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement