#[Resolved] why isnt this working?
1 messages · Page 1 of 1 (latest)
Also specify the y and z there's a change it will throw an error.
function createBarrierAt(player, location) {
const barrierBlock = player.dimension.getBlock({ x: location.x, y: location.y, z: location.z });
if (!barrierBlock) {
console.warn('Could not find a block at specified location.');
return;
}
const barrierPerm = BlockPermutation.resolve('minecraft:barrier');
barrierBlock.setPermutation(barrierPerm);
}
system.afterEvents.scriptEventReceive.subscribe((d) => {
const { id, message } = d;
if (id != "b:place") return;
if (message == "barrier") {
system.run(() => {
for (const player of world.getAllPlayers()) {
const barrierLocation = {
dimension: player.dimension.id,
x: Math.floor(player.location.x - 1),
y: Math.floor(player.location.y),
z: Math.floor(player.location.z)
};
createBarrierAt(player, barrierLocation);
}
});
}
});
also on the functions one the location.dimension it doesn't make sense tbh
maybe you mean player.dimension.getBlock({})
ignoring the manifest thing thats what a runtime error is
it doesnt error until you actually run the code that causes the error
No Errors
No errors in [code](#1242268742461820960 message)
What are you trying to do specifically?
Try this.
looking at this code it seems like its fine. If the other script is what errors thats probably where the issue is
(assuming this has been tried already since its what im going off of)**