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!


    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.

Check if player has switched their selected hotbar slot

Discussion in 'Skript' started by LimmaBeanz, Nov 28, 2021.

  1. LimmaBeanz

    LimmaBeanz New Member

    May 16, 2021
    Likes Received:
    Hey! I'm attempting to make a little scrolling system that uses the hotkeys/scroll wheel functions of the hotbar. Now I really want the player's selected slot to stay slot 0, but when the player scrolls to either slot 1 or slot 8, it changes the value of a variable. After every cycle to any slot other than 0, it forces the player's selected slot to return back to slot 0.

    on player's held item change:
    if {player_menu_active::%player%} is 1:
    if player changed selected slot to 1:
    add 1 to {selected_option::%player%}
    set player's selected hotbar slot to slot 0 of player
    if player changed selected slot to 8:
    subtract 1 from {selected_option::%player%}
    set player's selected hotbar slot to slot 0 of player `

    This doesn't work, but its the closest I've gotten, it's only the correct conditions I'm missing
    I'm aware the if statements in bold don't exist, but I'm attempting to find something that can work the same. If there's any cleaner or easily alternative to this, I'm open to any suggestions on how to make it more simple.

    Any help is really appreciated. Thanks!

Share This Page