Advertisement
Death_Data

b

Feb 22nd, 2019
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.20 KB | None | 0 0
  1.  
  2. local TweenService = game:GetService("TweenService")
  3.  
  4. local settings = {
  5. splatters_per_health_inc = 1, ---- The amount of blood splatters made when you lose (damage_inc) of health
  6. damage_inc = 8, ---- The increment of damage that must be done at a time to trigger blood splatters
  7. remove_time = 20, ---- The time (in seconds) until a blood splatter is removed after it is created
  8. min_splatter_time = 0, ---- The delay time (minimum) until another blood splatter is made
  9. max_splatter_time = 0.3, ---- The delay time (maximum) until another blood splatter is made
  10. min_transparency = 0.85, ---- The (minimum) transparency of a blood splatter
  11. max_transparency = 0.5, ---- The (maximum) transparency of a blood splatter
  12. min_size_x = 3, ---- The (minimum) size of a blood splatter on the X axis
  13. max_size_x = 8, ---- The (maximum) size of a blood splatter on the X axis
  14. min_size_z = 3, ---- The (minimum) size of a blood splatter on the Z axis
  15. max_size_z = 8, ---- The (maximum) size of a blood splatter on the Z axis
  16. tran_tw_time_min = 0.1, ---- The (minimum) time to tween the size of a blood splatter
  17. tran_tw_time_max = 0.75, ---- The (maximum) time to tween the size of a blood splatter
  18. size_tw_time_min = 0.1, ---- The (minimum) time to tween the transparency of a blood splatter
  19. size_tw_time_max = 0.5 ---- The (maximum) time to tween the transparency of a blood splatter
  20. }
  21.  
  22. --- These are the IDs of possible blood textures, I already set 3 up for u k
  23.  
  24. local blood_textures = {
  25. 176678030,
  26. 176678048,
  27. 176678086,
  28. 2271208303,
  29. 116830967,
  30. 785035165,
  31. 121678640,
  32. 890286383,
  33. 721969496
  34. }
  35.  
  36. local YourPlayer = game.Players.LocalPlayer
  37. local YourCharacter = nil
  38.  
  39.  
  40. -------------- I'm not responsible for any PAIN if you edit past this (pun intended)
  41.  
  42. local blood_folder = workspace["Blood.Splatter.Particles"]
  43.  
  44.  
  45. function CreateBlood(player_class,settings,blood_textures)
  46. if player_class ~= nil and YourCharacter ~= nil and YourCharacter:FindFirstChild("HumanoidRootPart") and (YourCharacter.HumanoidRootPart.Position - player_class.torso.Position).Magnitude < 100 then
  47. local blood_parts = {"Left Leg","Right Leg","Torso","Right Arm","Left Arm","Head"}
  48. local chosen_part = nil
  49. if player_class.humanoid ~= nil then
  50. repeat wait() chosen_part = blood_parts[math.random(1,#blood_parts)] until player_class.character:FindFirstChild(chosen_part)
  51. chosen_part = player_class.character[chosen_part]
  52. if player_class.humanoid.Health == 0 then
  53. local blood_emmiter = script.Blood:Clone()
  54. blood_emmiter.Parent = chosen_part
  55. blood_emmiter.Enabled = true
  56. end
  57. elseif chosen_part ~= nil then
  58. chosen_part = player_class.torso
  59. end
  60. if chosen_part ~= nil then
  61. local ray = Ray.new(chosen_part.Position, Vector3.new(0,-100,0))
  62. local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(ray, {blood_folder , unpack(player_class.character:GetChildren())} , true)
  63. if(hit) then
  64. local blood = Instance.new("Part",blood_folder)
  65. blood.Anchored = true
  66. blood.CanCollide = false
  67. blood.Transparency = 1
  68. blood.Name = "Particle_Blood"
  69. blood.FormFactor = Enum.FormFactor.Custom
  70. blood.Size = Vector3.new(0.01 , 0.1 , 0.01)
  71. blood.CFrame = CFrame.new(position)
  72. local blood_decal = Instance.new("Decal",blood)
  73. blood_decal.Transparency = 1
  74. blood_decal.Texture = "http://www.roblox.com/asset/?id=" .. blood_textures[math.random(1,#blood_textures)]
  75. blood_decal.Face = "Top"
  76. blood_decal.Color3 = Color3.fromRGB(160, 0, 0)
  77. game.Debris:AddItem(blood,settings.remove_time+20)
  78. local edit_blood = coroutine.wrap(function()
  79. local original_size = blood.Size
  80. local original_transparency = blood_decal.Transparency
  81. local new_transparency = math.random(settings.max_transparency*100,settings.min_transparency*100)/100
  82. local new_size = Vector3.new(math.random(settings.min_size_x*100,settings.max_size_x*100)/100 , blood.Size.Y , math.random(settings.min_size_z*100,settings.max_size_z*100)/100)
  83. local tran_tw_time = math.random(settings.tran_tw_time_min*100,settings.tran_tw_time_max*100)/100
  84. local size_tw_time = math.random(settings.size_tw_time_min*100,settings.size_tw_time_max*100)/100
  85.  
  86. local Info = TweenInfo.new(tran_tw_time,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
  87. local Goal1 = {Transparency = new_transparency}
  88. local Goal2 = {Size = new_size}
  89. local Tween1 = TweenService:Create(blood_decal,Info,Goal1)
  90. local Tween2 = TweenService:Create(blood,Info,Goal2)
  91. Tween1:Play()
  92. Tween2:Play()
  93. -- for i = 1,10*size_tw_time do
  94. -- wait()
  95. -- local perc = i/(10*size_tw_time)
  96. -- blood.Size = Vector3.new(original_size.X+(perc*new_size.X) , original_size.Y , original_size.Z+(perc*new_size.Z))
  97. -- end
  98. -- for i = 1,10*tran_tw_time do
  99. -- wait()
  100. -- local perc = i/(10*tran_tw_time)
  101. -- blood_decal.Transparency = original_transparency - (perc*new_transparency)
  102. -- end
  103. wait(settings.remove_time)
  104. local Info = TweenInfo.new(2,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
  105. local Goal1 = {Transparency = 1}
  106. local Tween1 = TweenService:Create(blood_decal,Info,Goal1)
  107. Tween1:Play()
  108. wait(1)
  109. blood:Destroy()
  110. end)
  111. edit_blood()
  112. end
  113. end
  114. end
  115. end
  116.  
  117. function monitor_character(player_class)
  118. local last_health = player_class.humanoid.Health
  119. player_class.humanoid.HealthChanged:connect(function()
  120. if(player_class.humanoid.Health < last_health) then
  121. if(last_health - player_class.humanoid.Health >= settings.damage_inc) then
  122. for i = 1,settings.splatters_per_health_inc*((last_health - player_class.humanoid.Health)/settings.damage_inc) do
  123. --create_blood_splatter(player_class)
  124. CreateBlood(player_class,settings,blood_textures)
  125. if(settings.max_splatter_time > 0) then
  126. wait(math.random(settings.min_splatter_time*100,settings.max_splatter_time*100)/100)
  127. end
  128. end
  129. end
  130. end
  131. last_health = player_class.humanoid.Health
  132. end)
  133. end
  134.  
  135.  
  136. function monitor_player(player)
  137. player.CharacterAdded:connect(function()
  138. print("ahhh")
  139. if player == YourPlayer then
  140. YourCharacter = player.Character
  141. end
  142. local player_class = {
  143. player = player,
  144. character = player.Character,
  145. ragdoll = player.Character:WaitForChild("ragdoll"),
  146. torso = player.Character:WaitForChild("Torso"),
  147. head = player.Character:WaitForChild("Head"),
  148. humanoid = player.Character:WaitForChild("Humanoid"),
  149. }
  150. monitor_character(player_class)
  151. end)
  152. repeat wait(0.1) until player.Character ~= nil
  153. local player_class = {
  154. player = player,
  155. character = player.Character,
  156. ragdoll = player.Character:WaitForChild("ragdoll"),
  157. torso = player.Character:WaitForChild("Torso"),
  158. head = player.Character:WaitForChild("Head"),
  159. humanoid = player.Character:WaitForChild("Humanoid"),
  160. }
  161. monitor_character(player_class)
  162. end
  163.  
  164. game.Players.PlayerAdded:connect(function(player)
  165. monitor_player(player)
  166. end)
  167.  
  168. for i,v in pairs(game.Players:GetChildren()) do
  169. monitor_player(v)
  170. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement