I'm trying to make a shop gui, but it does not load the item in the gui because it does not return a value.
My gui code:
My function code:
My gui code:
Code:
command /h:
trigger:
open virtual chest inventory with 6 rows named "&bShop" to player
format gui slot 22 of player with steak named "&6Steak" with lore "&f$100" to close then run [openSelection(steak,10,100,the player)]
Code:
function openSelection(selection: item, amount: number, price: number, buyer: player):
wait 2 ticks
open chest with 6 rows named "&bRevamped Shop" to {_buyer}
initBorder({_buyer})
set {scaledPrice} to {_price} * {_amount}
set {itemPlusAmount} to "%{_amount}% %{_selection}%"
set {iap} to {itemPlusAmount} parsed as item
format gui slot 13 of {_buyer} with {iap} named "&aBuy" with lore "&f$%{scaledPrice}%" to close then run [buy({_buyer}, {scaledPrice}, {_selection}, {_amount})]
format gui slot 28 of {_buyer} with red stained glass pane named "&cSet to 1" to close then run [openSelection({_selection}, 1, {_price}, {_buyer})]