Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.88 KB | None | 0 0
  1. local playerService = game:GetService("Players")
  2. local debris = game:GetService("Debris")
  3. local tweenService = game:GetService("TweenService")
  4. local folder
  5.  
  6. playerService.PlayerAdded:Connect(function (plr)
  7.    
  8.     if not workspace:FindFirstChild("Blood") then
  9.         folder = Instance.new("Folder", workspace)
  10.         folder.Name = "Blood"
  11.     end
  12.    
  13.     local charFolder = Instance.new("Folder", folder)
  14.     charFolder.Name = plr.Name
  15.    
  16.     plr.CharacterAdded:Connect(function (char) 
  17.        
  18.         local humanoid = char:WaitForChild("Humanoid")
  19.        
  20.         humanoid.Died:Connect(function ()
  21.             pcall(function ()
  22.                
  23.                 local torso = char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso") or nil
  24.                 local root = char:FindFirstChild("HumanoidRootPart") or nil
  25.                 local base
  26.                
  27.                 local function bloodPool (part, limbCenter)
  28.                    
  29.                     local pool = Instance.new("Part", charFolder)
  30.                     pool.CanCollide = false
  31.                     pool.BrickColor = BrickColor.new("Crimson")
  32.                     pool.Material = Enum.Material.Sand
  33.                     pool.Transparency = .2
  34.                     pool.CastShadow = false
  35.                     pool.Shape = "Cylinder"
  36.                     pool.Anchored = true
  37.                    
  38.                     pool.Size = Vector3.new(.1, 0, 0)      
  39.                     pool.CFrame = part.CFrame  
  40.                    
  41.                     if limbCenter then
  42.                         pool.CFrame = CFrame.new(torso.Position.X + math.random(-4, 4), base.Position.Y - (base.Size.Y / 2) + math.random(0, .2), torso.Position.Z + math.random(-4, 4))
  43.                     else
  44.                         pool.CFrame = CFrame.new(torso.Position.X + math.random(-4, 4), base.Position.Y + (base.Size.Y / 2), torso.Position.Z + math.random(-4, 4))
  45.                     end
  46.                    
  47.                     pool.Orientation = Vector3.new(0, 0, 90)
  48.                     tweenService:Create(pool, TweenInfo.new(math.random(.4, 4), Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Size = Vector3.new(.1, math.random(3, 7), math.random(3, 7))}):Play()
  49.                    
  50.                     debris:AddItem(pool, 9)
  51.                 end
  52.            
  53.                 if char.Humanoid.RigType == Enum.HumanoidRigType.R6 then
  54.                     wait(.2)
  55.                     if not char:FindFirstChild("Head") and workspace:FindFirstChild(plr.Name .. "-2") then
  56.                         char = workspace[plr.Name .. "-2"]
  57.                     end
  58.                 end
  59.                    
  60.                 repeat wait() until math.floor(torso.Velocity.Magnitude) == 0
  61.                 local baseBlacklist = char:GetChildren()
  62.                
  63.                 pcall(function ()
  64.                     for _,plr in pairs(game:GetService("Players"):GetPlayers()) do
  65.                         if plr.Character then
  66.                             for _,v in pairs(plr.Character:GetChildren()) do
  67.                                 if v:IsA("BasePart") then
  68.                                     table.insert(baseBlacklist, v)
  69.                                 elseif v:IsA("Accoutrement") then
  70.                                     table.insert(baseBlacklist, v:FindFirstChildWhichIsA("BasePart"))
  71.                                 elseif v:IsA("Tool") then
  72.                                     v:Destroy()
  73.                                 end
  74.                             end
  75.                         end
  76.                         if workspace:FindFirstChild(plr.Name .. "-2") then
  77.                             for _,p in pairs(workspace[plr.Name .. "-2"]:GetChildren()) do
  78.                                 if p:IsA("BasePart") then
  79.                                     table.insert(baseBlacklist, p)
  80.                                 elseif p:IsA("Accoutrement") then
  81.                                     table.insert(baseBlacklist, p:FindFirstChildWhichIsA("BasePart"))
  82.                                 end
  83.                             end
  84.                         end
  85.                     end
  86.                 end)
  87.                
  88.                 if type(baseBlacklist) == "table" then 
  89.                    
  90.                     local limbCenter = false
  91.                     base = workspace:FindPartsInRegion3WithIgnoreList(Region3.new(torso.Position - torso.Size * 2, torso.Position + torso.Size * 2), baseBlacklist, 1)[1]
  92.                                
  93.                     if not base then
  94.                         if char:FindFirstChild("Left Leg") then
  95.                             base = char["Left Leg"]
  96.                             limbCenter = true
  97.                         elseif char:FindFirstChild("LeftFoot") then
  98.                             base = char["LeftFoot"]
  99.                             limbCenter = true
  100.                         end
  101.                     end
  102.                    
  103.                     if base then
  104.                         for _,limb in pairs(char:GetChildren()) do
  105.                             if limb:IsA("BasePart") and limb.Name ~= "HumanoidRootPart" then
  106.                                 bloodPool(limb, limbCenter)
  107.                             end
  108.                         end
  109.                     end
  110.                 end
  111.             end)
  112.         end)
  113.     end)
  114. end)
  115.  
  116. playerService.PlayerRemoving:Connect(function (plr)
  117.     if folder:FindFirstChild(plr.Name) then
  118.         folder[plr.Name]:Destroy()
  119.     end
  120. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement