I used to have the same problem. This is how I solved it.
Fist add your money or point system commands
scoreboard objectives add moneyDisplay dummy
scoreboard objectives add moneyHidden dummy
Be sure these commands always repeat or in a repeating command block.
Now you want the 'moneyHidden' scoreboard to copy its data to the 'moneyDisplay' scoreboard
execute as @s run scoreboard players operation @s moneyHidden = @s moneyDisplay
execute as @a
means all players become the target and run the command.
@s
means the target or player that runs the command.
This means all players copy their data from 'monetHidden' to 'moneyDisplay' whenever this command runs.
This should also be repeating.
When adding money remember to add the score to the moneyHidden command so it works properly.
Now show the money on screen:
scoreboard objectives setdisplay sidebar moneyDisplay
scoreboard players add @a moneyDisplay
Make sure this command is also repeating.
Now let's work on removing the offline display from the scoreboard:
First, add a scoreboard that counts the player's in-game:
scoreboard objectives add PlayerCount dummy
Now add a fake player to 'playerCount'
scoreboard players add past PlayerCount 0
This 'past' will have the score of how many players were in before anyone leaves or joins.
Now you store the ever-changing amount of players in the game into another fake player
execute store result score new PlayerCount run execute if entity @a
execute store result score new PlayerCount
means the data gets collected as a fake player called 'new' in 'PlayerCount' scoreboard
run execute if entity @a
tells the command to count the number of players in the world.
The full command counts the number of players in the game and put the amount in the scoreboard 'PlayerCount' as the label(Fake Player) 'new'
This should be repeating.
Now check if the new and old player counts are different.
execute unless score new PlayerCount = past PlayerCount run scoreboard objectives remove moneyDisplay
unless score new PlayerCount = past PlayerCount
checks if the scores of 'new' in
'PlayerCount' and 'past' in PlayerCount is not the same.
run scoreboard objectives remove moneyDisplay
activates the command to remove the 'moneyDisplay' scoreboard
This should be repeating.
Now make is so 'past' player count and 'new' player count is equal
scoreboard players operation new PlayerCount = past PlayerCount
From here the scoreboard on the screen refreshes every time a person leaves or joins. All the money data is being stored in the 'moneyHidden' scoreboard which you can't see so no ones score will be reset.