Skript Metadata tags

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Goose

Supporter
Nov 23, 2019
439
33
28
Metadata Tags
Introduction
Metadata tags are a form of temporary value storage, where you tie a value to a block or entity and that value will be wiped when the server restarts. This is convenient for holding information about a entity or block where you don't have to worry about removing it later.

How do I use metadata tags?
Here's the syntax of metadata tags.
Code:
metadata [(value|tag)[s]] %strings% of %metadataholders%
%metadataholders%'[s] metadata [(value|tag)[s]] %string%

In short, metadata holders are an entity or a placed block. You can set metadata tags just like you would ever set a variable, or an expression, and metadata tags can be set to anything, as long as it isn't multiple. Do beware that metadata values only accept the set and delete operations. Here's some examples:
Code:
set metadata value "foo" of player to "bar"
delete metadata tag "barhee" of target block
set metadata value "tutorial" of player to metadata value "tutorial" of player + 1

# You can't do:
add 1 to metadata tag "yeehaw" of player
set metadata value "foobar" of player to true and false

Where should I use metadata tags?
You should only use metadata tags when attempting to store something that isn't meant to be long term, like what game a player is in, if a player has a specific GUI open, etc.
 
Last edited: