Simple chest collector not working!

  • 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 our Wiki for downloads and any other information about Skript!

HeliumBoi

New Member
Sep 15, 2023
8
0
1
22

So I have this code right here that has one error, but I can't find it.

Can someone explain ?


Code:
on chest interact:
    if name of event-block is "&6&lCollector":
        set {_chest} to event-block
        set {_inv} to inventory of {_chest}
        set {_balance} to balance of player
        set {_totalWorth} to 0
        loop 53 times:
            set {_item} to item from {_inv} at slot loop-number
            if {_item} is not air:
                if worth of {_item} is set:
                    set {_value} to worth of {_item}
                    set {_num} to {_item}'s amount
                    remove {_num} {_item} from {_inv}
                    set {_totalWorth} to {_totalWorth} + ({_value} * {_num})
                    set {_balance} to {_balance} + ({_value} * {_num})
                    send "&aSold %{_num}% x %{_item}% for %{_value}%."
        set balance of player to {_balance}
        send "&aTotal worth: %{_totalWorth}%."

command /chestgive:
    permission: myplugin.chestgive
    aliases: [givechest]
    trigger:
        give player a chest named "&6&lCollector"
        send "&aYou have been given a &6&lCollector chest!"
 
code_language.skript:
on rightclick on chest:
    if name of event-block is "&6&lCollector":
        set {_chest} to event-block
        set {_inv} to inventory of {_chest}
        set {_balance} to balance of player
        set {_totalWorth} to 0
        loop 53 times:
            set {_item} to item from {_inv} at slot loop-number
            if {_item} is not air:
                if worth of {_item} is set:
                    set {_value} to worth of {_item}
                    set {_num} to {_item}'s amount
                    remove {_num} {_item} from {_inv}
                    set {_totalWorth} to {_totalWorth} + ({_value} * {_num})
                    set {_balance} to {_balance} + ({_value} * {_num})
                    send "&aSold %{_num}% x %{_item}% for %{_value}%."
        set balance of player to {_balance}
        send "&aTotal worth: %{_totalWorth}%."

command /chestgive:
    permission: myplugin.chestgive
    aliases: [givechest]
    trigger:
        give player a chest named "&6&lCollector"
        send "&aYou have been given a &6&lCollector chest!"

Assuming you know what the other two errors are and how to address them

For future reference. Say what the errors are so the community can help you more