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!


    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 Is it possible to set variable as player?

Discussion in 'Skript' started by BrownMee, Mar 26, 2020 at 12:59 PM.

  1. BrownMee

    BrownMee Well-Known Member

    Apr 16, 2018
    Likes Received:
    Code (Text):
    1. on inventory click:
    2.     if inventory name of player's current inventory is "Smith Trading":
    3.         send "tes"
    4.         set name of clicked item to {_player}
    5.         loop all items in player's current inventory:
    6.             add loop-item to {inv::*}
    7.         open chest with 1 rows named "Smith Trading Successful" to {_player}
    8.         set {inv::*} to all items in {_player}'s current inventory
    9.         if {_player} has permission "smith.access":
    10.             delete {receipt.%{_player}%.%player%}
    11.         else:
    12.             set {receipt.%player%.%{_player}%} to true
    13.         close player's inventory
    i set the item to a player name
    so when i click the item
    "set name of clicked item to {_player}"
    so i set the player name to the variable
    open chest with 1 rows named "Smith Trading Successful" to {_player}

    basically im trying to open a chest to the {_player} name i just set
  2. Best Answer:
    Post #2 by Goose, Mar 27, 2020 at 7:05 PM
  3. Goose

    Goose Well-Known Member

    Nov 23, 2019
    Likes Received:
    You can set the variable to a player
    Code (Text):
    1. set {_player} to player
    then open the chest to that player with the variable
    Code (Text):
    1. open chest with 1 row named "Smith Trading Successful" to {_player}