1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Event-block is not working in a variable

Discussion in 'Skript' started by IsntZ, Jul 19, 2022.

Thread Status:
Not open for further replies.
  1. IsntZ

    IsntZ Member

    Joined:
    Jun 15, 2022
    Messages:
    23
    Likes Received:
    0
    I want to use event-block in a gui and it wasn't working so i tried to make a test skript
    when i did:

    on left click on beacon:
    set {_block} to event-block
    set {_p} to player
    if {_block} is beacon:
    if {gens::%player's uuid%::beacon::*} contains location of {_block}:
    play sound "entity.item.pickup" with volume 3 to the player
    close player's inventory
    remove 1 from {gc::%player's uuid%}
    log "%player% picked up %{block.%player%}% generator at (%location of {block.%player%}%)" to "gens.log"
    set {_block} to air
    console command "givegen beacon %{_p}% 1"
    send action bar " &7You picked up your gen!" to player
    remove location of {_block} from {gens::%player's uuid%::beacon::*}

    it didnt work
    but when i did:

    on left click on beacon:
    set {_block} to event-block
    set {_p} to player
    if {_block} is beacon:
    if {gens::%player's uuid%::beacon::*} contains location of event-block:
    play sound "entity.item.pickup" with volume 3 to the player
    close player's inventory
    remove 1 from {gc::%player's uuid%}
    log "%player% picked up %{block.%player%}% generator at (%location of {block.%player%}%)" to "gens.log"
    set event-block to air
    console command "givegen beacon %{_p}% 1"
    send action bar " &7You picked up your gen!" to player
    remove location of event-block from {gens::%player's uuid%::beacon::*}

    it worked

     
  2. Best Answer:
    Post #5 by IsntZ, Jul 20, 2022
  3. MiiTsY

    MiiTsY Member

    Joined:
    May 27, 2022
    Messages:
    41
    Likes Received:
    1
    set {_block} to event-block

    should be like
    set {_block} to location of event-block

    or something like that
     
  4. IsntZ

    IsntZ Member

    Joined:
    Jun 15, 2022
    Messages:
    23
    Likes Received:
    0
    in the line:
    set {_block} to air
    and the line:
    if {_block} is beacon:

    it neens to be a block
     
  5. MiiTsY

    MiiTsY Member

    Joined:
    May 27, 2022
    Messages:
    41
    Likes Received:
    1
    why are you using temp variables in the first place?
     
  6. IsntZ

    IsntZ Member

    Joined:
    Jun 15, 2022
    Messages:
    23
    Likes Received:
    0
    Just for testing
    --- Double Post Merged, Jul 20, 2022, Original Post Date: Jul 20, 2022 ---
    I fixed it by doing: "set {_block} to event-block's location" and using: "block at {_block}"
     
Thread Status:
Not open for further replies.

Share This Page

Loading...