Wiki 9Minecraft Wiki 9Minecraft

Store and Retrieve Player Data with Variables

Java EditionPluginGuides 4FAQ 10Related mods 48
DownloadSkript Plugin

Get the files on 9Minecraft

Contents (3)
  1. Understanding Skript Variables
  2. Creating and Using Variables
  3. Persistent Storage

Understanding Skript Variables

Variables let you remember information about players, like their level, coins, or playtime. Skript supports both temporary variables (lost on server restart) and persistent variables (saved to disk).

Creating and Using Variables

Temporary variables are simple:

`

command /setcoins <number>:

trigger:

set {coins::%player%} to argument 1

send "You now have %{coins::%player%}% coins" to player

`

The %player% part makes each player have their own coin count. Retrieve it anytime with {coins::%player%}.

Persistent Storage

For data that survives server restarts, use YAML files:

`

command /balance:

trigger:

send "Your balance: %{balance::%player's uuid%}%" to player

`

Skript automatically saves these variables. Use player's uuid instead of just the player name to handle name changes correctly. Variables are incredibly flexible—use them for points, cooldowns, settings, or any custom data your server needs.

More guides for this mod