Help with Player Selector Skript

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

Granhu

Member
Jul 26, 2022
1
0
1
23
When i try to click on the Player's Head nothing happens. I need help with the Player Selector



command /test:
permission: test.use
permission message: &cNo permissions
trigger:
set {_gui} to a new chest inventory with 3 row with name "&bTest"
set slot 13 of {_gui} to lime terracotta named "&aCreate"
open {_gui} to player

on inventory click:
if name of event-inventory is "&bTest":
if index of event-slot = 13:
cancel event
make player execute command "test2"



command /test2:
trigger:
set {_y} to -1
set {_x} to a new chest inventory with 4 row with name "Gui Test"
loop all players:
add 1 to {_y}
set slot {_y} of {_x} to loop-player's skull
open {_x} to player



on inventory click:
if name of event-inventory is "Gui Test":
if index of event-slot = {_y}:
cancel event
send "Test"
 
This code is ultra unreadable but it seems like you are accessing {_y} in the "on inventory click" event.
{_y} is a local variable, and you cannot use it in another function.