Solved shop gui

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

Colle23

New Member
Jul 20, 2023
8
1
3
17
can someone make us a shop skript?
like make us the skript without the items so we put the command and the items modifying it pls
 
Not gonna lie, the code you provided is a little messy. In case you haven't; consider using functions for repetitive actions in code instead of having them span across your code from being duplicated a lot. For example:

Code:
# An idea of messy code, imagine this had many more of these if statements, it'd take up many lines
if player has 10 of gold ingot named "&eTest":
   remove 10 gold ingot from player's inventory

if player has 12 of gold ingot named "&eTest":
   remove 12 gold ingot from player's inventory
You can instead compact the example code written above into the function I provide here:

Code:
# This code allows you to refer to the function + data you wish to remove in a single line anytime you use it!
function buy(p: player, n: number, i: item):
   if {_p} has {_n} of gold ingot named "&eTest":
      remove {_n} of gold ingot from {_p};s inventory
      give {_p} 1 of {_i} named "&aTest 2"

command buydiamond:
   trigger:
      buy(player, 12, diamond) # The player to remove it from, the amount to remove then the item to give
 
  • Like
Reactions: Doodle