/xp
Adds, sets, or queries experience points or levels for one or more players. This is an alias for /experience.
Syntax
/xp <add|set|query> <targets> <amount> [levels|points]Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| action | literal | Required | The action to perform: add, set, or query. |
| targets | entity | Required | The player(s) to modify. |
| amount | integer | Required | The amount of experience. For add, can be negative. For query, this parameter is omitted. |
| unit | literal | Optional | Whether the amount refers to levels or points. Defaults to points. |
Examples
/xp add @s 30 levelsAdds 30 experience levels to yourself.
/xp set @a 0 pointsResets the experience points (within current level) for all players to 0.
/xp query @p levelsQueries and displays the nearest player's current level.
Common Mistakes
- Confusing points and levels, points fill the bar within a level, levels are the number shown on the bar.
- Using /xp set with points above the threshold for the current level, each level requires a different number of points.
Notes
The /xp command is functionally identical to /experience. Both are valid aliases in Java Edition.
Related Commands
Need a Minecraft server?
Try these commands on Astroworld or host your own server.
Try Astroworld Hosting