Minecraft wiki entry for scoreboard, associated text: Syntax
scoreboard players set <targets> <objective> <score> (Java Edition)
scoreboard players set <player: target> <objective: string> <count: int> (Bedrock Edition)
Description
Set the targets' scores in the given objective, overwriting any previous score.
Arguments
JE: <targets>: score_holder
BE: player: target: WildcardCommandSelector<Actor>
Specifies the score holders.
Must be a selection of score holders. It may be either a target selector, a player name, a UUID‌[Java Edition only], a unique ID of an entity‌[Bedrock Edition only], or * for all score holders tracked by the scoreboard. Named player needn't be online, and it even needn't be a real player's name.
JE: <objective>: objective
BE: objective: string: basic_string
Specifies the objective.
In Java Edition, it must be an valid scoreboard objective name. In Bedrock Edition, it must be either a single word that isn't a number (allowed characters: -, :, ., _, A-Z, a-z, and 0-9) or a double-quoted string.
JE: <score>: integer
BE: count: int: int
Specifies the score to set to.
Must be a 32-bit integer number.
Result
Command Trigger Java Edition Bedrock Edition
... set ... the arguments are not specified correctly Unparseable Failed
the objective doesn't exist Failed
<targets> or player: target fails to resolve to one or more score holders
the objective isn't writable N/A
On success Set the score value.
Output
Command Edition Situation Success Count /execute store success ... /execute store result ...
... set ... Java Edition On fail 0 0 0
On success 1 1 the number of targets multiplied by the specified score
Bedrock Edition On fail 0 N/A N/A
On success 1 N/A N/A