Solved How could i make a upgrade gui shop?

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

Status
Not open for further replies.
take a template
Code:
on skript load:
    if gui "shop" and "blocks" does not exist:
        create new gui with id "shop" with virtual chest with 3 rows named "Shop":
            wait 1 tick
            format gui slot (numbers between 0 and 26) with gray stained glass pane named " "
            unformat gui slot (numbers between 10 and 16)
            format gui slot 10 with stone named "&fBlocks":
                close player's inventory
                open gui "blocks" to player
        create new gui with id "blocks" with virtual chest with 3 rows named "Blocks":
            wait 1 tick
            format gui slot 0 with 16 stone named "&616&fx Stone" with lore "Price: $10":
                if player's balance >= 10:
                    remove 10 from player's balance
                    give 16 stone to player
                    send "&7[&cSHOP&7] Successfully purchased &616&7x Stone"
                else:
                    send "&7[&cSHOP&7] You don't have enough money!"
command shop:
    trigger:
        open gui "shop" to player
 
Goose, what i meant, was that you have to have a specific item to be able to buy an item.. So for example, You have to have stone named "test" to be able to buy grass! Not money!
[doublepost=1582637864,1582636759][/doublepost]
take a template
Code:
on skript load:
    if gui "shop" and "blocks" does not exist:
        create new gui with id "shop" with virtual chest with 3 rows named "Shop":
            wait 1 tick
            format gui slot (numbers between 0 and 26) with gray stained glass pane named " "
            unformat gui slot (numbers between 10 and 16)
            format gui slot 10 with stone named "&fBlocks":
                close player's inventory
                open gui "blocks" to player
        create new gui with id "blocks" with virtual chest with 3 rows named "Blocks":
            wait 1 tick
            format gui slot 0 with 16 stone named "&616&fx Stone" with lore "Price: $10":
                if player's balance >= 10:
                    remove 10 from player's balance
                    give 16 stone to player
                    send "&7[&cSHOP&7] Successfully purchased &616&7x Stone"
                else:
                    send "&7[&cSHOP&7] You don't have enough money!"
command shop:
    trigger:
        open gui "shop" to player

There is no errors, but when i run the command it does nothing??
 
You can loop the items in the player's inventory and then check if the loop-item is the item you want

Code:
loop all items in player's inventory:
    if loop-item is stone named "test":
        # do stuff
 
You can loop the items in the player's inventory and then check if the loop-item is the item you want

Code:
loop all items in player's inventory:
    if loop-item is stone named "test":
        # do stuff
Thank you, and the template you made doesnt work?
 
Try this edited version of the template

Code:
function openInv(p: player, t: text):
    if {_t} is "shop":
        open virtual chest with 3 rows to {_p}
        wait 1 tick
        format gui slot (numbers between 0 and 26) of {_p} with gray stained glass pane named " " to do nothing
        format gui slot (numbers between 10 and 16) of {_p} with air to do nothing
        format gui slot 10 of {_p} with stone named "&fBlocks" to run function openInv({_p}, "blocks")
    if {_t} is "blocks":
        open virtual chest with 3 rows to {_p}
        wait 1 tick
        format gui slot 0 of {_p} with 16 stone named "&616&fx Stone" with lore "Price: $10" to run:
            loop all items in {_p}'s inventory:
                if loop-item is stone named "test":
                    give 16 stone to player
                    send "&7[&cSHOP&7] Successfully purchased &616&7x Stone"
                else:
                    send "&7[&cSHOP&7] You don't have enough money!"
command shop:
    trigger:
        openInv(player, "shop")
 
  • Like
Reactions: Potato
Status
Not open for further replies.