Help with variables

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

Savarek

Member
Sep 20, 2024
1
0
1
19
How can i add the {_value} to the {selled} variable?

Code:
variables:
    {selled} = 0

on inventory click:
    if event-inventory = (metadata tag "SellerGui" of player):
        cancel event
        if index of event-slot is 20:
            if player has carrot:
                set {_value} to the value of the placeholder "math_0:1_{checkitem_amount_mat:carrot}" for the player
                add {_value} to {selled}
                execute console command "/clear %player% carrot %{_value}%"
                message "Total carrot selled is %{selled}%"
                send "%{_value}%" to the player


command /gui:
  permission: op
  permission message: "&4You can't do it!"
  trigger:

    set metadata tag "SellerGui" of player to chest inventory with 5 rows named "test"
    set slot 20 of metadata tag "SellerGui" of player to a carrot named "Example"
    
    open (metadata tag "SellerGui" of player) to player