The goals came from all directions, and that usually has meant good news for the Islanders this season. But they were sloppy on the attack against a Senators team that hadn’t won in weeks, and the Isles ultimately couldn’t rally a final time.

Friday night’s 6-5 loss was the Islanders’ first regulation defeat at Barclays Center in 11 games this season, snapped their winning streak at four games and ended Ottawa’s winless skid at seven games.

Ryan Dzingel’s power-play goal past Jaroslav Halak at 1:38 of the third was the winner after 10 goals between the two teams chased both starting goaltenders before the game was even 32 minutes old.

“It stings, but it’s almost a good learning tool,” Doug Weight said after his team scored at least five goals in a game for the 12th time in 25 games but lost for the first time while doing so. “We made some really poor decisions at their blue line, which we haven’t been doing. Both teams kept both teams in it for a while there.”

Thomas Greiss got the start in goal and the Islanders were down 2-0 before the midway point of the first. Dzingel scored on a breakaway after a soft dump-in attempt by Alan Quine and Zack Smith blasted one by Greiss after Matt Duchene bodied John Tavares off the puck.

Anthony Beauvillier and Anders Lee scored in a 2:14 span later in the first to tie it, but Dion Phaneuf’s pass went in off Bobby Ryan’s skate at 18:55 for a 3-2 Senators lead after one.

In the second, goals by Lee and Andrew Ladd in a 1:16 span gave the Islanders their first lead. Rookie Thomas Chabot tied it at 8:26 and Jason Chimera untied it 14 seconds later, chasing Craig Anderson from the Ottawa net.

Subscribe to Newsday’s sports newsletter

Receive stories, photos and videos about your favorite New York teams plus national sports news and events.

On a power play at 11:49, Mike Hoffman winged one by Greiss, who threw up his hands at missing another untouched shot and departed for Halak.

“It was just a bad game,” said Greiss, who let in five goals on 20 shots. “My timing was off. I’m not going to overthink it. Every once in a while, one goes down the drain.”

Considering the Islanders came in having won seven of eight, this one didn’t hurt quite as much as it could have. But with the team headed on a four-game trip that includes treacherous stops in Tampa and Pittsburgh, there is more than enough for Weight to correct this weekend.

That very much includes his third line. Quine, Brock Nelson and Josh Ho-Sang were on for three Senators goals, and it’s now been one point in the last 14 games for Nelson, the established scorer of those three.

“We need more,” Weight said of that line. “I just want to see some harder minutes. When you’re not scoring, you’ve got to show you’re doing other things, run through some guys. I just want to see some jam from those guys. It’s needed.”

The Isles poured on pressure in the final 90 seconds with Halak pulled, but Mike Condon made three of his 19 saves to preserve the win.

This Islanders team can score, almost at will. That wasn’t the issue on Friday.

“When you’ve got the offense going like we do, sometimes you take chances you shouldn’t,” said Chimera, who scored his first goal of the season. “We were a little careless, and against a desperate team, it’s going to bite you.”