Solved Check if player is holding a 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.

Uzumaki

Well-Known Member
Feb 20, 2017
310
10
18
33
There is a way to check if player's tool is a block(not a weapon or things such as armor and other items)?

ps.
code_language.skript:
if player's tool is a block:
not work
 
Are you meaning something like this?
code_language.skript:
command /testblock:
    trigger:
        if player's held item is dirt:
            send "Yes its dirt"
 
how about elaborating on your very descriptive "not work"
code_language.skript:
command testing:
    trigger:
        if player's held item is block:
            broadcast "ye"

Tried with blocks and other items = nothing.


code_language.skript:
command testing:
    trigger:
        if player's held item is not block:
            broadcast "ye"

Works with any item/block.
 
hm thats strange. you can do it with skript mirror though
code_language.skript:
on click:
    if player's tool is not air: #air counts as a block
        set {_item} to player's tool
        if {_item}.getType().isBlock():
            send "%player's tool% is a block."
 
thanks a lot, this works.
[doublepost=1527716568,1524865939][/doublepost]
hm thats strange. you can do it with skript mirror though
code_language.skript:
on click:
    if player's tool is not air: #air counts as a block
        set {_item} to player's tool
        if {_item}.getType().isBlock():
            send "%player's tool% is a block."
do you have any idea why this do not work on 1.12?, thanks
 
it should. are there errors? what skript ver?
version dev35b(does this also on dev27)

error:

code_language.skript:
can't understand this condition: '{_o_o}.getType().isBlock()' (WE.sk, line 95: if {_o_o}.getType().isBlock():')

code

code_language.skript:
set {_o_o} to player's tool
if {_o_o}.getType().isBlock():
    #...
 
i tested it and its loading fine for me i have no idea why its not working for you. are you using spigot?
 
Status
Not open for further replies.