playerService.PlayerAdded:Connect(function(K)K.CharacterAdded:Connect(function(K)local U=K:WaitForChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")local E=K:WaitForChild("\072\117\109\097\110\111\105\100")local R=E.Health local t=bloodParticles:Clone()t.Parent=U E.HealthChanged:Connect(function(E)if E<R then R=E spawn(function()for E=1,blood_part_per_hit,1 do local R=math.random(-20,20)/10 local D=U.Position+Vector3.new(R,0,R)local J=Vector3.new(0,-8,0)local Z=raycast(K,D,J)if Z then t:Emit(2)delay(.5,function()local K=createBlood(Z.Position)expandBlood(K)delay(blood_destroy_delay,function()deleteBlood(K)end)end)end wait(math.random(.5,2)/10)end end)else R=E end end)end)end)

playerService.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		
		local rootPart = character:WaitForChild("HumanoidRootPart")
		
		local humanoid = character:WaitForChild("Humanoid")
		local oldHealth = humanoid.Health
		
		local particlesClone = bloodParticles:Clone()
		particlesClone.Parent = rootPart
		
		humanoid.HealthChanged:Connect(function(health)
			if health < oldHealth then
				
				oldHealth = health
				
				spawn(function()
					for i = 1, blood_part_per_hit do
						
						local randomPosition = math.random(-20, 20) / 10
						
						local raycastOrigin = rootPart.Position + Vector3.new(randomPosition, 0, randomPosition)
						local raycastDirection = Vector3.new(0, -8, 0)
						
						local raycastResult = raycast(character, raycastOrigin, raycastDirection)
						
						if raycastResult then
							particlesClone:Emit(2)
							
							delay(0.5, function()
								local newBlood = createBlood(raycastResult.Position)
								expandBlood(newBlood)
								
								delay(blood_destroy_delay, function()
									deleteBlood(newBlood)
								end)
							end)
						end
						
						wait(math.random(0.5, 2) / 10)
					end
				end)
			else
				oldHealth = health
			end
		end)
	end)
end)
