MIAMI (CBSMiami) – A teen accused of accidentally shooting and killing a teenage girl in a Miami apartment faced a judge.

Thalys Oliveira, 18, who has been charged with manslaughter, will be tried as an adult.

READ MORE: MDFR Identifies "Voice In The Rubble" Victim

Fifteen-year-old Arya Gray, a student at Miami Beach Senior High School, was shot while in Oliveria’s apartment in the 7800 block of NE 10th Avenue.

Family members say the shooting happened right in front of Gray’s older sister.

Miami Fire Rescue rushed Gray to Jackson Memorial Hospital in critical condition, where she later died.

READ MORE: Gov. Ron DeSantis Signs Bill That Bans 'Picketing And Protesting' Outside A Person's Home

According to the police report, witnesses said Oliveira, who was 17 at the time, was ‘recklessly brandishing’ a gun while inside his home.

Two of the witnesses told police they asked him to put the gun away, which he did, but a short time later, he had the gun again. The witnesses said he “pointed the firearm at the victim, placing his finger on the trigger and fired one round and striking the victim in the head,” according to the report.

During questioning, police say, he told them he was playing with the gun when he “pulled the trigger, saw a flash and struck the victim one time in the head.”

MORE NEWS: Former Substitute Teacher Enreeka Nalasco Accused Of Giving Drugs To Teen Girls For Sexual Favors

During Thursday’s appearance, a judge place Oliveira on house arrest and ordered him not to speak with any of the witnesses.