#why this doesnt work need helpp

1 messages · Page 1 of 1 (latest)

late delta
#
import { world, system } from "@minecraft/server";

world.afterEvents.playerPlaceBlock.subscribe(data => {
  if (data.block.permutation.matches('minecraft:sandstone')) {
    const blocklocx = data.block.x
    const blocklocy = data.block.y
    const blocklocz = data.block.z
      system.runTimeout(() => {
        data.player.runCommandAsync(`setblock ${blocklocx} ${blocklocy} ${blocklocz} air`)
      }, 120);
      if (data.player.hasTag('clutch') || data.player.hasTag('bridge')) {
        data.player.runCommandAsync('give @p sandstone 1 0 {"can_place_on":{"block":["gold_block","dirt","grass","sandstone","planks"]}}')
      } 
}
})```
my code is to after place a block i will get back the block in the give command, but i doesnt work. im in stable version
brittle starBOT
#
No Errors

No errors in [code](#1229237367018229860 message)

zealous vessel
#

Which part is not working exactly?

late delta
#

the block isnt given to me

zealous vessel
late delta
#

but why i do that in command block it works .-.

#

my brain isnt braining

zealous vessel
#

Absolutely no idea

late delta
#

ello

#

eloo

#
import { world, system } from "@minecraft/server";

world.afterEvents.playerPlaceBlock.subscribe(data => {
    if (data.block.permutation.matches('minecraft:sandstone')) {
        const player = data.player
        const blocklocx = data.block.x
        const blocklocy = data.block.y
        const blocklocz = data.block.z
        
        system.runTimeout(() => {
            player.runCommandAsync(`setblock ${blocklocx} ${blocklocy} ${blocklocz} air`)
        }, 120);
        
        if (player.hasTag('clutch') || player.hasTag('bridge')) {
            player.runCommandAsync('give @p sandstone 1 0 {"minecraft:can_place_on":{"blocks":["gold_block","dirt","grass","sandstone","planks"]}}')
        } 
    }
})
#

maybe this works

#

lemme try

zealous vessel
#

Was he just missing the namespace? lol

late delta
late delta
#

Its just a supposition

#

💀

#

hel nah i miss that

late delta
#

ty guys

late delta
zealous vessel
late delta
zealous vessel
#

NOO ;w; (Anyway #off-topic please)

late delta
late delta
#

how can i miss the 's'

#

perfect, if you have any other problems, ping the king ( King :3 )

late delta
zealous vessel
#

Also you don’t have to use commands because apparently the native method is stable

zealous vessel
#

.setCanPlaceOn it’s part of the ItemStack class

late delta
#

lemme see the doc about that

#

as i work more on commands