Chris Brown's Baby Mama Royalty's Not Safe Around His 'Gang' Friends

7/15/2015 3:19 PM PDT

Chris Brown lost more than $50k worth of gear in the home invasion ... it could also cost him daddy time, because his baby mama is worried Royalty's in danger when she's with Chris and his homies.

Sources close to Nia Guzman tell TMZ ... she thinks many of Chris' friends are gang members or gang-affiliated, and the robbery shows they've now turned on Chris. We're told she's not cool with Royalty being around that element. 

As we first reported ... Chris' mother also thinks last night's hit was an inside job.

It's bad timing for Chris. He just filed docs asking a judge to hammer out a formal custody agreement -- partly because he says Nia's been denying him visits with Royalty.

If the court sees things Nia's way it could affect custody.