How can I open a server form when entering the world?
mc.world.events.playerSpawn.subscribe((eventData) => {
if (!eventData.initialSpawn) return;
const player = eventData.player
const menu = (player) => {
const form = new ui.ActionFormData()
.title("teste")
.body("teste")
for (let i = 0; i <= 20; i++) {
form.button("button " + i)
}
form.show(player)
}
const run = mc.system.runSchedule(() => {
player.runCommandAsync("testfor @s").then(() => {
mc.system.clearRunSchedule(run)
menu(player)
})
}, 1)
})
I tried that but it didn't work lol