How to attach variables to a player that persist after server reset and the player leaves

  • 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 community!

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

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

WayPastStupid

Member
Apr 10, 2025
1
0
1
I'm making a 1.21 version of the hypixel pit(IP:waypaststupid.play.hosting) and someone recommended using skript instead of command blocks so i started learning yesterday.
I'm trying to add a killstreak system right now that gives a bounty every 10th kill in a row and clears the killstreak and bounty on death.

Code:
on join:
    set metadata "KillStreak" of player to 0
    set metadata "KillsToBounty" of player to 0
    set metadata "Bounty" of player to 0
on death:
    victim is a player
    attacker is a player
    set metadata "KillStreak" of victim to 0
    set metadata "KillsToBounty" of victim to 0
    set metadata "Bounty" of victim to 0
    add 1 to "KillStreak" of attacker
    add 1 to "KillsToBounty" of attacker
    is "KillsToBounty" of attacker equal to 10:
        set "KillsToBounty" of attacker to 0
        add 1 to "Bounty" of attacker
        broadcast "%attacker% has just reached a killstreak of %"KillStreak" of attacker%"
 
Last edited by a moderator:
You'd need to use variables like:
{killcounts::%uuid of player%}
These will then exist when the player disconnects or the server restarts. Metadata is not permanent.