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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

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

> 1001 Not working?

Discussion in 'Skript' started by ItsMCB, May 31, 2018.

Thread Status:
Not open for further replies.
  1. ItsMCB

    ItsMCB Member

    Joined:
    May 20, 2018
    Messages:
    46
    Likes Received:
    1
    Why is my code allowing the user's pickaxe level to go over 1000? I have looked this up and it seems like I'm doing the right thing.
    Code (Skript):
    1. on mine:
    2.     if player's tool is a pickaxe:
    3.         if {_exp} > 1001:
    4.             message "&cTOOL POWERUP OVERLOADED! &fYou should use your powerup (RIGHT CLICK)."
    5.             stop
    6.         else:
    7.             set {_lore} to lore of player's tool
    8.             set {_split::*} to {_lore} split at " "
    9.             set {_exp} to uncolored {_split::2} parsed as a number
    10.             set {_exp} to {_exp} + 1
    11.             set lore of player's tool to "&e&lEXP: &f%{_exp}% &7/1000"
    The goal of this code is that if the player's pickaxe EXP is over 1000 it alerts the player that its overloading and should use it on other "powerups".
     
  2. Snow-Pyon

    Moderator Resource Staff

    Joined:
    Jan 25, 2017
    Messages:
    1,236
    Likes Received:
    176
    Medals:
    The {_exp} variable isn't set at that point. You have to do it in the following way for it to work:
    Code (Skript):
    1. on mine: # I would use on mine of any ore
    2.  
    3.   tool is a pickaxe
    4.   set {_exp} to first element out of (uncolored tool's lore parsed as "EXP: %number%")
    5.    
    6.   if {_exp} is greater than 1000:
    7.     send "Your message"
    8.   else:
    9.     set tool's lore to "<yellow><bold>EXP: %{_exp} + 1%"
     
  3. ItsMCB

    ItsMCB Member

    Joined:
    May 20, 2018
    Messages:
    46
    Likes Received:
    1
    Thanks for the response, but for some reason the EXP is staying at 1 no matter how much I mine.
    upload_2018-5-31_22-42-42.png
    --- Double Post Merged, Jun 1, 2018, Original Post Date: Jun 1, 2018 ---
    Never mind I fixed it, thank you for helping me :emoji_slight_smile:
     
Thread Status:
Not open for further replies.

Share This Page

Loading...