Help with block placing skript

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

hx7e

Member
Mar 1, 2020
3
0
0
23
Hi there! I am trying to make a Skript for my mini game which allows players to place obsidian that will be removed after 40 seconds. However, I do not want players to be able to destroy the map by placing obsidian in water sources, grass, flowers, etc. I ONLY want the player to be able to place the obsidian if the block where it will be placed is an air block. This is what I have so far, but it doesn't work.

EDIT: To clarify the problem, the current issue is that I am not able to place obsidian anywhere on the map.

Code:
on place:
    if player's tool is obsidian:
        if block at event-location is air:
            wait 40 seconds
            set block at event-location to air
            stop
        else:
            cancel event
    else:  
        cancel event
 
Last edited:
Hi there! I am trying to make a Skript for my mini game which allows players to place obsidian that will be removed after 40 seconds. However, I do not want players to be able to destroy the map by placing obsidian in water sources, grass, flowers, etc. I ONLY want the player to be able to place the obsidian if the block where it will be placed is an air block. This is what I have so far, but it doesn't work.

EDIT: To clarify the problem, the current issue is that I am not able to place obsidian anywhere on the map.

Code:
on place:
    if player's tool is obsidian:
        if block at event-location is air:
            wait 40 seconds
            set block at event-location to air
            stop
        else:
            cancel event
    else: 
        cancel event
Is the place worldguarded?
 
try this
Code:
on place of obsidian:
    if past event-block is air:
        cancel event
        wait 40 seconds
        set event-block to obsidian
        stop trigger
    else:
        cancel event
 
try this
Code:
on place of obsidian:
    if past event-block is air:
        cancel event
        wait 40 seconds
        set event-block to obsidian
        stop trigger
    else:
        cancel event
thanks, unfortunately this didn't work either. I think the issue may be that event-block and event-location refer to the block the player is targeting before they place?
 
Status
Not open for further replies.