playersService.PlayerAdded:Connect(function(s)s.CharacterAdded:Connect(function(s)local W=s:WaitForChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")local c=s:WaitForChild("\072\117\109\097\110\111\105\100")local E=c.Health local F=bloodParticles:Clone()F.Parent=W c.HealthChanged:Connect(function(c)if c<E then E=c spawn(function()for c=1,blood_parts_per_hit,1 do local E=W.Position+Vector3.new(math.random(-20,20)/10,0,math.random(-20,20)/10)local n=Vector3.new(0,-8,0)local e=raycast(s,E,n)if e then F:Emit(2)delay(.5,function()local s=createBlood(e.Position)expandBlood(s)delay(blood_destroy_delay,function()deleteBlood(s)end)end)end wait(math.random(.5,2)/10)end end)else E=c end end)end)end)

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)
