How to set a block to a block name stored in a 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.

cottondell

Member
Aug 16, 2019
14
0
1
Hi!
I want to set a block to another block which is stored in a variable.
This is the line of code ive tried:
set block at location of block to {block}

The location of block is the location of a block which was broken because what i want is a system where when a block is broken, its gets replaced with the same block, to do this i also tried:
set block at location of block to block
but that doesn't work either.

No errors show up when i reload skript, it just doesnt work when i try it.


Please Help, thank you!
 
That came up with this error:
upload_2019-8-18_22-0-49.png
 

Attachments

  • upload_2019-8-18_21-56-44.png
    upload_2019-8-18_21-56-44.png
    419.2 KB · Views: 302
That works but if i try,
set event-block to {block}
it doesn't work.

Also, how do you asign text to be script on skunity?
 
Code:
on place:
    if name of player's tool is "&6&lRegenerating Block":
        set {rb.player.%location of block%} to player
        set {rb.pos.%location of block%} to true
        set {rb.block.%location of block%} to "coal ore" -- this line is temp, i would have it so it is the blocks name that was placed
        create a new hologram with line "&6&lGenerator" and store in {holograms.gb.%player%.%location of block%}
        

on break:
    if {rb.pos.%location of block%} is true:
        if {rb.player.%location of block%} is player:
            wait 0.1 seconds
            set event-block to {rb.block.%location of block%}
        else:
            message "{@MsgPrefix} &4You can not use other peoples Generator blocks!"
            cancel event
 
nope:
Code:
set {rb.block.%location of block%} to "coal ore" - would be set to the block placed down
 
that works but is there a way to have {rg.block.%location of block%} set to the block's name cause i have it in an "on place"?
 
that works but i need it so if the block placed down was a grass_block then {rb.block.BLOCK} is set to grass_block but if the block placed down is a block of stone then {rb.block.BLOCK} is set to stone.
(they would need to be named correct but i already have a cmd to give you a block named correctly)
[doublepost=1566237459,1566236668][/doublepost]what i done is close too working but after the wait it sets the variable to air?!?!

Code:
on break:
    if {rb.pos.%location of block%} is true:
        if {rb.player.%location of block%} is player:
            message "%{rb.block.%location of block%}%"
            wait 0.1 seconds <-------
            message "%{rb.block.%location of block%}%"
            set event-block to {rb.block.%location of block%}
        else:
            message "{@MsgPrefix} &4You can not use other peoples Generator blocks!"
            cancel event
 
says the same thing, and if i had {rb.block.%event-block%}, if i had multiple of the same block would it be personalized to each block
 
Basically im making regenerating blocks which when you break, it replaces it with what it was so i need {rb.block.%event-block%} to set the block to what it was before it was broken. so i need it so {rb.block.%event-block%} is different even if the same block was placed down but in a different posittion because i also have {rb.player.%event-block%} so i can see if the player breaking the block is the owner of the regenerating block and the players can have multiple RegeneratingBlocks placed down.
I'm sorry for confusing you.
[doublepost=1566239419,1566239168][/doublepost]If theres a way too easily set a block to what it was before it was broken then that would be fine
 
H3A the block wont always be coal ore, i could place down iron_ore then it wouldnt work with that and ive tried that alooooot
 
Create a list then, If it's randomized.
Else just make a function.
 
Status
Not open for further replies.