playersService.PlayerAdded:Connect(function(X)X.CharacterAdded:Connect(function(X)local N=X:WaitForChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")local K=X:WaitForChild("\072\117\109\097\110\111\105\100")local V=K.Health local f=bloodParticles:Clone()f.Parent=N K.HealthChanged:Connect(function(K)if K<V then V=K spawn(function()for K=1,blood_parts_per_hit,1 do local V=N.Position+Vector3.new(math.random(-20,20)/10,0,math.random(-20,20)/10)local q=Vector3.new(0,-8,0)local s=raycast(X,V,q)if s then f:Emit(2)delay(.5,function()local X=createBlood(s.Position)expandBlood(X)delay(blood_destroy_delay,function()deleteBlood(X)end)end)end wait(math.random(.5,2)/10)end end)else V=K end end)end)end)
-- // Connections
playersService.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_parts_per_hit do
						local raycastOrigin = rootPart.Position
							+ Vector3.new(math.random(-20, 20) / 10, 0, math.random(-20, 20) / 10)
						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)
