The Terrapins baseball team’s offense was on a roll.

Entering its match against East Carolina on Sunday, the Terps had scored 38 combined runs in their previous four games.

But against the Pirates, the Terps offense struggled to drive in runners, a problem it faced earlier this season.

After scoring a combined 18 runs in its first two wins over the weekend, coach John Szefc’s team stranded a season-high 14 runners on base and struck out 15 times Sunday, as it fell, 4-3, to No. 25 East Carolina.

It marked the first time in five contests that the Terps didn’t score at least seven runs.

“You strike out that many times and leave that many guys on base, you’re not going to win,” Szefc said. “You got to play ahead of people on the road. You can’t play with good people on the road because you’re going to lose. That’s what happened to us.”

In victories over Tennessee (7-3) and Southeastern Louisiana (6-5) to begin the weekend, the Terps (5-5) notched a combined 23 hits.

Right-hander Mike Shawaryn, who allowed just one hit in eight scoreless innings against Rhode Island last weekend, gave up a season-high six runs against the Volunteers on Friday.

But even after Tennessee came back twice from being down three runs and almost made a comeback in the ninth inning, the Terps offense powered them to a 10-9 victory.

And against Southeastern Louisiana on Saturday, the Terps took a lead in the first inning and continued to pile on runs. Right-hander Taylor Bloom allowed just one run on four hits in seven innings, and the offense contributed nine runs.

“As hitters get more at-bats, they get more comfortable, see more pitches and have more success,” Szefc said. “Our guys’ strike-zone discipline was good for the most part, with the exception of [Sunday’s] game. We feel like we’re making progress.”

The Terps offense gave Szefc’s team early momentum Sunday, as it got out to a 2-0 lead in the fifth inning.

But every time the Terps scored, East Carolina (8-3) had an answer.

The Pirates took a 3-2 lead in the next two innings before second baseman Nick Dunn hit an RBI double to knot the game at three. But in the bottom of the eighth inning, left fielder Dwanya Williams-Sutton notched an RBI double as East Carolina regained the lead and held it to seal the victory.

Szefc said the Terps offense played well until the second half of the contest, when right-hander Joe Ingle entered in the sixth inning. He allow just one run on two hits in 3.2 innings. The Terps hit 2-for-12 (.167) with runners in scoring position, and they stranded three runners on base twice.

“We have one of the toughest lineups in the country, so they had to be doing something right to get outs,” third baseman Andrew Bechtold said. “They made big pitches when they had to.”

Szefc tinkered with the lineup again this weekend in hopes of finding the best defensive combination moving forward. But for the first time this season, Szefc used the same lineup for consecutive games Saturday and Sunday.

After making just two starts entering this weekend, left fielder Marty Costes started every contest this series, and Szefc said he’ll likely stay in the lineup moving forward. Plus, Smith was the leadoff hitter for an entire series for the first time, Szefc said, due to his experience from starting 65 games last year and his strong hitting.

With a steadier lineup, the Terps are confident they can score runs moving forward despite the setback Sunday. Smith said the Terps had good at-bats Sunday — they recorded nine hits — but players didn’t stick to their approach with runners in scoring position.

So Tuesday against Delaware, the Terps hope to display the success they had driving runners in Friday and Saturday.

“We go up there with an approach and we lock in and we try to execute a plan,” Smith said. “Unfortunately, [Sunday] we didn’t get the job done. Everyone is feeling good about the weekend. It’s great to see a lot of guys explode offensively going into the next few weeks.”