I am trying to keep an item always in my inventory but it doesn't work!

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

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

xBackpack

Member
Mar 13, 2022
4
0
1
19
Version: 2.6.1
Author: Me
Addons: SkBee (I don't think it is relevant)
Extra Info:
The first time I try to move it, the script stops it, but the second time the script doesn't stop it. The third time, the script stops it, the fourth time, the script doesn't stop it. Etc.

Code:
https://pastebin.com/fGiRwibW
or

every 0.01 seconds:
loop all players:
if slot 8 of loop-player's inventory is not nether star:
if loop-player's inventory contains nether star named "&aSkyBlock Menu &7(Right Click)" with lore "&7View all of your SkyBlock" and "&7progress, including your Skills," and "&7Collections, Recipes, and more!" and "" and "&eClick to open!":
remove 1 nether star from loop-player's inventory
set slot 8 of loop-player's inventory to nether star named "&aSkyBlock Menu &7(Right Click)" with lore "&7View all of your SkyBlock" and "&7progress, including your Skills," and "&7Collections, Recipes, and more!" and "" and "&eClick to open!"
on right click:
if player's tool is nether star:
if uncolored name of player's tool is "SkyBlock Menu (Right Click)":
open chest inventory with 6 rows named "SkyBlock Menu" to player
set slot 0 of player's current inventory to gray stained glass pane named " "
set slot 1 of player's current inventory to gray stained glass pane named " "
set slot 2 of player's current inventory to gray stained glass pane named " "
set slot 3 of player's current inventory to gray stained glass pane named " "
set slot 4 of player's current inventory to gray stained glass pane named " "
set slot 5 of player's current inventory to gray stained glass pane named " "
set slot 6 of player's current inventory to gray stained glass pane named " "
set slot 7 of player's current inventory to gray stained glass pane named " "
set slot 8 of player's current inventory to gray stained glass pane named " "
set slot 9 of player's current inventory to gray stained glass pane named " "
set slot 10 of player's current inventory to gray stained glass pane named " "
set slot 11 of player's current inventory to gray stained glass pane named " "
set slot 12 of player's current inventory to gray stained glass pane named " "
set {playerhead} to a player head
add "{SkullOwner:%player%}" to nbt of {playerhead}
set slot 13 of player's current inventory to {playerhead} named "&aYour SkyBlock Profile"
on inventory click:
if name of event-inventory is "SkyBlock Menu":
if index of event-slot is 13:
send "test" to player
else:
cancel event

I appreciate the help!
 
Hello! I think you can use this:

Code:
# Prevent dissapear menu opener

on inventory click:
    clicked slot's name is "&aSkyBlock Menu &7(Right Click)"
    cancel event
    
on drop:
    event-item's name is "&aSkyBlock Menu &7(Right Click)"
    cancel event



# Add menu opener if dissapeared
on player's held item change:
    if name of (slot 8 of player's inventory) is "&aSkyBlock Menu &7(Right Click)":
        stop
    drop slot 8 of player's inventory
    set slot 8 of player's inventory to nether star named "&aSkyBlock Menu &7(Right Click)" with lore "&7View all of your SkyBlock" and "&7progress, including your Skills," and "&7Collections, Recipes, and more!" and "" and "&eClick to open!"



# Open menu

on right click:
    if player's tool is nether star:
        if uncolored name of player's tool is "SkyBlock Menu (Right Click)":
            open chest inventory with 6 rows named "SkyBlock Menu" to player
            set slot 0 of player's current inventory to gray stained glass pane named " "
            set slot 1 of player's current inventory to gray stained glass pane named " "
            set slot 2 of player's current inventory to gray stained glass pane named " "
            set slot 3 of player's current inventory to gray stained glass pane named " "
            set slot 4 of player's current inventory to gray stained glass pane named " "
            set slot 5 of player's current inventory to gray stained glass pane named " "
            set slot 6 of player's current inventory to gray stained glass pane named " "
            set slot 7 of player's current inventory to gray stained glass pane named " "
            set slot 8 of player's current inventory to gray stained glass pane named " "
            set slot 9 of player's current inventory to gray stained glass pane named " "
            set slot 10 of player's current inventory to gray stained glass pane named " "
            set slot 11 of player's current inventory to gray stained glass pane named " "
            set slot 12 of player's current inventory to gray stained glass pane named " "
            set {playerhead} to a player head
            add "{SkullOwner:%player%}" to nbt of {playerhead}
            set slot 13 of player's current inventory to {playerhead} named "&aYour SkyBlock Profile"



# Menu functionality

on inventory click:
    if name of event-inventory is "SkyBlock Menu":
        cancel event
        if index of event-slot is 13:
            send "test" to player
 
Status
Not open for further replies.