Checking the lore of a clicked item

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

HAQ20

Member
Jul 26, 2025
3
0
1
So i have this code

Code:
# Prevent moving into containers
on inventory click:
    if lore of clicked cursor contains "&9Soulbound to &7":
        send "&7[DEBUG] Soulbound item detected on clicked cursor." to event-player
        if clicked inventory is not event-player's inventory:
            cancel event
            send "&cYou can't store soulbound items!" to event-player
And i want it for a soulbind skript for 1.21.4 and for some reason it just never gets past the line that checks for the lore
 
So i have this code

Code:
# Prevent moving into containers
on inventory click:
    if lore of clicked cursor contains "&9Soulbound to &7":
        send "&7[DEBUG] Soulbound item detected on clicked cursor." to event-player
        if clicked inventory is not event-player's inventory:
            cancel event
            send "&cYou can't store soulbound items!" to event-player
And i want it for a soulbind skript for 1.21.4 and for some reason it just never gets past the line that checks for the lore
Seems like it's working on me? Though there was syntax error on " clickec cursor ", i fixed it.


CSS:
on inventory click:
    if lore of event-slot contains "&9Soulbound to &7":
        send "&7[DEBUG] Soulbound item detected on clicked cursor." to event-player
        if clicked inventory is not event-player's inventory:
            cancel event
            send "&cYou can't store soulbound items!" to event-player
 
What addons do you have? Becouse for me even the debug dosn't activate its very wierd,
Also this is my full code (With your fix)

Code:
# Soulbind command to bind item in hand
command /soulbind [<text>]:
    permission: soulbind.use
    trigger:
        if player's tool is air:
            send "&cYou must hold an item to soulbind it!"
            stop
        if line 1 of lore of player's tool contains "Soulbound to":
            send "&cThat item is already soulbound!"
            stop
        if arg-1 is set:
            set {_target} to arg-1 parsed as player
            if {_target} is not set:
                send "&cPlayer not found!"
                stop
            set {soulbound.%uuid of {_target}%::*} to player's tool
            set line 1 of lore of player's tool to "&9Soulbound to &7%{_target}%"
            send "&aItem soulbound to %{_target}%!"
        else:
            set {soulbound.%uuid of player%::*} to player's tool
            set line 1 of lore of player's tool to "&9Soulbound to &7%player%"
            send "&aItem soulbound to you!"

# Prevent dropping soulbound items
on drop:
    if lore of event-item contains "&9Soulbound to &7%event-player%":
        cancel event
        send "&cYou can't drop a soulbound item!" to event-player

on inventory click:
    if lore of event-slot contains "&9Soulbound to &7":
        send "&7[DEBUG] Soulbound item detected on clicked cursor." to event-player
        if clicked inventory is not event-player's inventory:
            cancel event
            send "&cYou can't store soulbound items!" to event-player

# Prevent pickup of someone else's soulbound item
on pickup:
    if lore of event-item contains "&9Soulbound to &7":
        if lore of event-item does not contain "&9Soulbound to &7%event-player%":
            cancel event
            send "&cThis item is not bound to you!" to event-player

# Keep soulbound items on death
on death of player:
    loop all items in victim's inventory:
        if lore of loop-item contains "&9Soulbound to &7%victim%":
            add loop-item to {soulbind.death.%victim's uuid%::*}
            remove loop-item from victim's inventory
on respawn:
    wait 1 tick
    loop {soulbind.death.%event-player's uuid%::*}:
        give loop-value to event-player
    delete {soulbind.death.%event-player's uuid%::*}
I don't know a lot about the addons but the only ones im using are Skbee and Skquery.
 
I don't really see the issue with your code. It's working perfectly fine and functioning as it should on my server. I, too, have SkBee and SkQuery only.
The only problem I saw was when moving the item to a chest or another player's inventory. It doesn't detect it.



CSS:
command /soulbind [<text>]:
    permission: soulbind.use
    trigger:
        if player's tool is air:
            send "&cYou must hold an item to soulbind it!"
            stop
        if line 1 of lore of player's tool contains "Soulbound to":
            send "&cThat item is already soulbound!"
            stop
        if arg-1 is set:
            set {_target} to arg-1 parsed as player
            if {_target} is not set:
                send "&cPlayer not found!"
                stop
            set {soulbound.%uuid of {_target}%::*} to player's tool
            set line 1 of lore of player's tool to "&9Soulbound to &7%{_target}%"
            send "&aItem soulbound to %{_target}%!"
        else:
            set {soulbound.%uuid of player%::*} to player's tool
            set line 1 of lore of player's tool to "&9Soulbound to &7%player%"
            send "&aItem soulbound to you!"

# Prevent dropping soulbound items
on drop:
    if lore of event-item contains "&9Soulbound to &7%event-player%":
        cancel event
        send "&cYou can't drop a soulbound item!" to event-player

on inventory click:
    if lore of event-item contains "&9Soulbound to &7%event-player%":
        if click type is shift+lmb or shift+rmb or number key or left mouse button or right mouse button:
            cancel event
            send "&cYou can't move soulbound items!" to player



# Prevent pickup of someone else's soulbound item
on pickup:
    if lore of event-item contains "&9Soulbound to &7":
        if lore of event-item does not contain "&9Soulbound to &7%event-player%":
            cancel event
            send "&cThis item is not bound to you!" to event-player

# Keep soulbound items on death
on death of player:
    loop all items in victim's inventory:
        if lore of loop-item contains "&9Soulbound to &7%victim%":
            add loop-item to {soulbind.death.%victim's uuid%::*}
            remove loop-item from victim's inventory
on respawn:
    wait 1 tick
    loop {soulbind.death.%event-player's uuid%::*}:
        give loop-value to event-player
    delete {soulbind.death.%event-player's uuid%::*}
 
Dude that you soooo much it works now, i was testing it with a chest so that's why i didn't notice it working on other stations. Have a nice day