1. Grant experience as levels
Levels and points behave very differently — pick the unit that matches what you actually want
/xp add @p 30 levels
What it does Will give the nearest player 30 more level(s).
Add, subtract, set, or query a player's experience and level
Points are the green orbs you collect, while level is the green number above the bar. The higher your level, the more points it takes to reach the next one — so giving 30 levels is not the same as giving 30 points.
On Bedrock the command looks like /xp <amount>[L] <player> — the trailing L means the unit is levels, and there is no set or query form
The examples below come out of the same generator as the form above, so the commands and explanations always match what the tool produces. Copy one and adjust it from there
Levels and points behave very differently — pick the unit that matches what you actually want
/xp add @p 30 levels
What it does Will give the nearest player 30 more level(s).
set overwrites the current value rather than adding to it — use it to wipe the slate at the start of a round
/xp set @a 0 levels
What it does Will set all players's level(s) to exactly 0.
A negative amount subtracts — the basis of a "pay with XP" system
/xp add @s -100 points
What it does Will reduce themselves (whoever runs the command)'s experience point(s) by 100.
This is the first example above, run through every edition and version this tool supports. Versions that produce the same result share a row
/xp add @p 30 levels
/xp 30L @p