The victim, Sean Cook, 26, died after being shot in the chest.
Cook went to his friend Shea Harkins' house in Palm Harbor on Thursday night to play video games, the Pinellas County Sheriff's Office said.
Harkins, 26, told police the two were playing in his bedroom, and he left the room to retrieve his rifle, a Colt M4 he had been customizing.
Harkins said he returned to the bedroom and pointed the rifle at Cook as a joke. Cook asked Harkins, “What, are you going to shoot me?”
Harkins said he then pulled the trigger, believing the weapon to be unloaded, the sheriff's office said.
Cook was rushed to Mease Countryside Hospital where he was pronounced dead a short time later.
Harkins was arrested and charged Friday. He was released from the county jail after posting $10,000 bail.