Hats

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

JackyBoy

Member
Feb 4, 2017
104
1
18
21
Hi, I'm making a hat system where a player will right-click on an item and that item will then get removed from the players tool slot and be set to their head slot.

I've got that part working just fine but my issue is, how would I be able to set a new hat on the player If they already have a hat on and return the current hat back to their inventory.

So, I need help with
Removing the head slot item and placing it in the inventory.

Here is my current code:
Code:
on right click holding diamond sword:
  name of player's held item contains "Hat":
  if player's helmet is not air:
    # Code here
    stop
  else:
    set player's helmet to player's tool
    remove player's tool from player's inventory
 
I've not tested this, but something similar to
Code:
set {_item} to player's helmet
give player {_item}
set player's helmet to player's tool
remove player's toold from player's inventory
 
  • Like
Reactions: JackyBoy
Hi, I'm making a hat system where a player will right-click on an item and that item will then get removed from the players tool slot and be set to their head slot.

I've got that part working just fine but my issue is, how would I be able to set a new hat on the player If they already have a hat on and return the current hat back to their inventory.

So, I need help with
Removing the head slot item and placing it in the inventory.

Here is my current code:
Code:
on right click holding diamond sword:
  name of player's held item contains "Hat":
  if player's helmet is not air:
    # Code here
    stop
  else:
    set player's helmet to player's tool
    remove player's tool from player's inventory
Here's what I would do:
Code:
on right click holding diamond sword:
  name of player's held item contains "Hat":
  if player's helmet is not air:
    give player's helmet to player
    delete helmet of the player
  else:
    set player's helmet to player's tool
    remove player's tool from player's inventory
 
Code:
on right click:
  if name of player's held item contains "Hat":
    if player's tool is air:
    # Code here
     stop
    else:
      if player's tool is not air:
        set player's helmet to player's tool
        remove player's tool from player's inventory

I believe this is a good solution.
 
Status
Not open for further replies.