playerService.PlayerAdded:Connect(function(z)z.CharacterAdded:Connect(function(z)local h=z:WaitForChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")local U=z:WaitForChild("\072\117\109\097\110\111\105\100")local k=U.Health local V=bloodParticles:Clone()V.Parent=h U.HealthChanged:Connect(function(U)if U<k then k=U spawn(function()for U=1,blood_part_per_hit,1 do local k=math.random(-20,20)/10 local b=h.Position+Vector3.new(k,0,k)local g=Vector3.new(0,-8,0)local l=raycast(z,b,g)if l then V:Emit(2)delay(.5,function()local z=createBlood(l.Position)expandBlood(z)delay(blood_destroy_delay,function()deleteBlood(z)end)end)end wait(math.random(.5,2)/10)end end)else k=U end end)end)end)
--Connections
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)
