1. 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!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Skript Metadata tags

Discussion in 'Tutorials' started by Goose, Apr 22, 2021.

  1. Goose


    Nov 23, 2019
    Likes Received:
    Metadata Tags
    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 (Text):
    1. metadata [(value|tag)[s]] %strings% of %metadataholders%
    2. %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 (Text):
    1. set metadata value "foo" of player to "bar"
    2. delete metadata tag "barhee" of target block
    3. set metadata value "tutorial" of player to metadata value "tutorial" of player + 1
    5. # You can't do:
    6. add 1 to metadata tag "yeehaw" of player
    7. 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.
    #1 Goose, Apr 22, 2021
    Last edited: Apr 24, 2021
    • Agree Agree x 1

Share This Page