Help: save placed block names in variable

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

Neocky

Member
Sep 15, 2021
1
0
1
Hello,

i want to save the name of custom heads in a variable when placed and use them for some if statements when broken.
This is currently my script and the message on place just says <nothing>:

Code:
on place of player head:
  message "%name of event-block%" to player
  if name of event-block is "&6Cow":
    set {%location%.Block_Name} to name of event-block


on break of player head:
  if {%location%.Block_Name} is "&6Cow":
    send ":)"

Does anyone know why i can't get the name of the player head when being placed?
 
Code:
if name of player's tool contains  "&6Cow":
Basically that's all you need to do for the placement part, you can do the exact same thing with the breaking part aka the variable part:
Code:
set {%location%.Block_Name} to name of player's tool
The logic seems fine, just note that blocks don't have names so event-block wouldn't work in this case. Also use "contains" instead of "is", sometimes "is" is too accurate for it to work.
Code:
if {%location%.Block_Name} contains "&6Cow":
If that makes any sense
 
Status
Not open for further replies.