Help with Skript open Gui clicking a entity

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

Status
Not open for further replies.

Tonipop

Member
Aug 15, 2021
12
0
1
22
hello, i need a help making a GUI .
version is 1.16.5
Skript 2.6 , SkQuery v4.1.4, MorkazSk v1.2, skRayFall v1.9.25, skript-gui v1.3-beta1 ,Skellett v1.9.11
i CAN'T use Tuske Because of error, so i installed Skript-gui (but idk how it works)

the Gui and click worked
Code:
on click on armor stand:
    if name of clicked entity is "gunshop":
        open chest with 3 rows named "&cGUN SHOP" to player
        if player's money is less than 270:
            format slot 0 of player with wooden shovel named "&7MP5" with lore "&fType: &bSMG" and "&fAmmo: &cRed Hawk" and "&fPrice: &c$270 You can not afford" to be unstealable
        if player's money is more than or equal to 270:
            format slot 0 of player with wooden shovel named "&7MP5" with lore "&fType: &bSMG" and "&fAmmo: &cRed Hawk" and "&fPrice: &a$270" to close then run [console command "shot give %player% mp5"]->[subtract 270 from player's money]->[send "&aYou bought a &7MP5"]


BUT , when I open the Gui it no works i can take ( it shouldn't to be stealable) the item but can't make execute the command
using on command works but i don't want to use because they might use in anywhere ...

so for that reason i wanted to put in a entity and only can access the GUI clicking the entity.
 
I see many problems here, Let me try fixing it, and explaining how it works...
I suggest you not use the Skript-GUI addon or tuske, but use the good ol' vannila one.
here's my skript:
Code:
on right click on armor stand:
    if entity's name is "gunshop":
        set metadata "gunshop" of player to chest inventory with 3 rows named "&cGUN SHOP"
        set slot 3 of metadata tag "gunshop" of player to wooden shovel named "&7MP5" with lore "&fType: &bSMG%nl%&fAmmo: &cRed Hawk%nl%&fPrice: &c$270"
#the %nl% means next line, this is the vanilla way
#now we need to make it so it subtracts the money from the player


on inventory click:
    if event-inventory = (metadata tag "gunshop" of player):
        cancel event
        if index of event-slot is 3:
            subtract 270 from player's money
            give to player 1 wooden shovel named "&7MP5" with lore "&fType: &bSMG%nl%&fAmmo: &cRed Hawk%nl%&fPrice: &c$270"
 
I see many problems here, Let me try fixing it, and explaining how it works...
I suggest you not use the Skript-GUI addon or tuske, but use the good ol' vannila one.
here's my skript:
Code:
on right click on armor stand:
    if entity's name is "gunshop":
        set metadata "gunshop" of player to chest inventory with 3 rows named "&cGUN SHOP"
        set slot 3 of metadata tag "gunshop" of player to wooden shovel named "&7MP5" with lore "&fType: &bSMG%nl%&fAmmo: &cRed Hawk%nl%&fPrice: &c$270"
#the %nl% means next line, this is the vanilla way
#now we need to make it so it subtracts the money from the player


on inventory click:
    if event-inventory = (metadata tag "gunshop" of player):
        cancel event
        if index of event-slot is 3:
            subtract 270 from player's money
            give to player 1 wooden shovel named "&7MP5" with lore "&fType: &bSMG%nl%&fAmmo: &cRed Hawk%nl%&fPrice: &c$270"


I see, then i gotta use vanilla with this code, thanks .
 
Status
Not open for further replies.