#run things until they expire?

1 messages · Page 1 of 1 (latest)

tulip lava
#

Try trying this way with the version of minecraft/server 1.9.0-beta, minecraft/server-ui 1.2.0-beta.

tulip lava
#

@high dome How weird. To me, works perfectly.

tulip lava
#

Ok

tulip lava
#

@high dome yes

sand talon
#

think u can do this ```js
function vanish(player) {
new ModalFormData()
.title("Vanish")
.slider("Duration (Minutes)", 1, 5, 1)
.show(player).then(data => {
const duration = data.formValues[0];
const dur = system.runInterval(() => {
for (const player of world.getPlayers()) {
player.runCommandAsync("gamemode spectator @s");
player.runCommandAsync("clear @s");
}
});
system.runTimeout(() => {
system.clearRun(dur);
}, 20 * 60 * Number(duration));
});
}

world.afterEvents.itemUse.subscribe(data => {
if (data.itemStack.typeId === "minecraft:stick") {
vanish(data.source);
clicknoise(data.source);
}
});```