Help With Setting Blocks

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

IlluminatiThug69

New Member
Dec 4, 2017
5
0
0
25
I'm new to skript and I don't really know much so if this question is stupid, that's why.

I want to set a block at a certain set location to a gold block, but only if the block is air. I tried to search online and I looked in the documentation, but to no success. This is the code I currently have, but its getting a bunch of errors. Please help!

code_language.skript:
variables:
    {XValue} = 0
    {YValue} = 0
    {ZValue} = 0

command /test <player>:
    description: wip
    trigger:
        set {XValue} to the argument's x-coordinate
        set {YValue} to the argument's y-coordinate
        set {ZValue} to the argument's z-coordinate
        if block at location at {XValue}, {YValue}, {ZValue} is air:
            set block at location at {XValue}, {YValue}, {ZValue} to gold_block
        else:
            message "&cError" to argument
 
code_language.skript:
command /test <player>:
    trigger:
        if block at arg-1 is air:
            set block at arg-1 to gold_block
        else:
            message “&cError” to arg-1
 
code_language.skript:
command /test <player>:
    trigger:
        if block at arg-1 is air:
            set block at arg-1 to gold_block
        else:
            message “&cError” to arg-1
I tried this, but since I wanted to change the block at a certain coordinates I changed arg-1 to the coordinates and I get the error "air is not an entity type".

Is it possible to set a block at certain coordinates not necessarily the player's coordinates?
 
Use the location function location(x, y, z, world)
I changed my code to this but now I'm getting an error "can't understand this condition". I'm obviously not typing the code correctly so could someone help me get the proper code?
code_language.skript:
        if block at location(50, 50, 50, "world") is air:
            set block at location(50, 50, 50, "world") to gold_block
 
I changed my code to this but now I'm getting an error "can't understand this condition". I'm obviously not typing the code correctly so could someone help me get the proper code?
code_language.skript:
        if block at location(50, 50, 50, "world") is air:
            set block at location(50, 50, 50, "world") to gold_block
what skript version are you on
 
I updated to the latest version and now I am getting the error "Can't compare a block with 'air'" in my if statement line.
 
Status
Not open for further replies.