Solved Unplaceable Block

  • 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.
May 11, 2022
11
1
3
23
How do I make a block unplaceable, and not conflict with my other code? My current code looks like this:

on right click with beacon:
if name of tool of player is "&b&lRevive Beacon":
send "&aRight Click Works!"
subtract 1 of beacon named "&b&lRevive Beacon" from player's inventory

on place of beacon:
if name of tool of player is "&b&lRevive Beacon":
send "&4You can't place that block!"
cancel event

It works if you have over 3 revive beacons, but if you only have either one or two, the beacon will still place.
 
Cancel the right click event and remove the place event.
Code:
on right click with beacon:
    if name of tool of player is "&b&lRevive Beacon":
        cancel event
        remove 1 beacon named "&b&lRevive Beacon" from player's inventory
 
Cancel the right click event and remove the place event.
Code:
on right click with beacon:
    if name of tool of player is "&b&lRevive Beacon":
        cancel event
        remove 1 beacon named "&b&lRevive Beacon" from player's inventory

That works like a charm! Thank you so much!
 
Status
Not open for further replies.