Setting Variable to player's experience

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

Status
Not open for further replies.

akros

Member
Mar 2, 2020
3
0
1
I have this code and i want to set the variable {_xp} to the amount of experience a player has got so later on i can give it to them with the vanilla minecraft command /experience add %player% %{_xp}%, but when i set it to the level of the player it set its to the level, not the amount. is there a way i can make it so either the command gives levels, or it sets the variable {_xp} to the amount of xp?

Code:
command /xpbottle:
    trigger:
        set {_xp} to level of player
        execute console command "/experience set %player% 0"
        give player paper named "XP Bottle ≫ &a%{_xp}%" with lore "&a%{_xp}%" and "&aRight Click to redeem your XP!"

on right click holding paper:
    if name of tool contains "XP Bottle ≫":
        set {_xp} to line 1 of lore of player's held item
        remove 1 of player's held item from player's inventory
        execute console command "/experience add %player% %{_xp}%"
        send "&9You have redeemed &a%{_xp}% &9XP!"

Im not using any skript add ons, this isnt my server and he refuses to put them on, im unsure why.
 
Status
Not open for further replies.