A federal judge has approved $8 million in residual payments from bankrupt Relativity Media to the Hollywood unions for screenwriters, directors and actors.

U.S. Bankruptcy Court Judge Michael Wiles approved a request Friday by the studio attorneys to earmark the $8 million in its future funds to the unions. The residuals and funds for “participation agreements” are part of a total of $28 million owed to performers and producers, according to a filing from Relativity’s newly designated chief restructuring officer, Brian Kushner.

Relativity’s ability to maintain ties to the creative community is contingent on it fulfilling those financial obligations, its lawyers stressed during the hearing. Relativity was in the Manhattan court on Friday to secure a $45 million loan to allow it to continue operating while it goes through the bankruptcy process. Wiles agreed to a smaller $9.5 million cash infusion to sustain operations until a hearing on Aug. 14, when a bankruptcy court judge will decide whether to grant the company access to the full amount of funding it seeks.

The unions — the Directors Guild of America, SAG-AFTRA and the Writers Guild of America — have lien rights on motion pictures such as “Masterminds” and “Kidnap” that Relativity has yet to release. If the studio’s creditors want to sell those assets in order to get paid, they will need to strike a deal with the various guilds first, according to bankruptcy specialists.

In a joint statement to Variety, the guilds said they are “closely monitoring” the situation, adding, It is a top priority to ensure that our members are treated fairly and compensated properly for their work, even when a producer is in a distressed financial situation.”

The language in Kushner’s filing is unequivocal: “Pursuant to certain of the Collective Bargaining Agreements, certain of the Debtors’ are contractually obligated to remit some or all of Talent’s residual compensation to a designated employee benefit plan. Further, as is common in the film industry for certain production studios, pursuant to these Collective Bargaining Agreements, the obligation to remit the residuals to Guilds, in certain instances, is secured through perfected liens on all rights, title, interests and proceeds for each film from which residuals obligation arise.”

“In addition, the Debtors, and other studios in the United States, offer certain parties bonuses based upon box office performance, deferments based upon gross or net proceeds, or a share – or “participation” – in a film or television program’s revenue stream through individual profit participation or license agreements. The Debtors use participations to attract and retain name brand producers and other Talent. In these instances, Talent’s right to receive participations is generally independent of their right to receive residuals. Similarly, the Debtors may offer participations in connection with obtaining intellectual property, such as the assignment of rights to a screenplay, an exclusive license to create a film based on a book, or the use of a brand or work of art within a film or television program. Furthermore, third party distributors of the Debtors’ films may be entitled to a percentage of the film’s receipts (as well as recoupment of distribution expenses). Like residuals, the Debtors are contractually required to pay participations.”

Founded by Ryan Kavanaugh, the Beverly Hills-based Relativity Media filed for bankruptcy on Thursday after failing to procure a loan to pay off its $320 million debt.