#server form upon login

1 messages · Page 1 of 1 (latest)

tranquil sapphire
#

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

lime portal
tranquil sapphire
#

Hmmmmmm, ok thx

foggy nova
tranquil sapphire
#

OK

lime portal
shy shadowBOT
#

Suggestion for @tranquil sapphire

Click the link above to get code for 'force-show' in ScriptAPI repository.

proven elm
#

Cuz there may be issues with opening the form then completely destroying the sense of the use of playerJoin

lime portal
proven elm
quasi ridge
#

Doesn't playerjoin only fire the first time a player joins. Not when they respawn or after they leave

random lark
#

Use playerSpawn, since playerJoin is changed to only have playerId and playerName

There's a property that check if it's join or respawn

eventData.initialSpawn
proven elm
tranquil sapphire
tranquil sapphire
tranquil sapphire
#

I'm studying a little more about async/await

proven flower
proven flower
#

just store it in a let at the top and compare it to current roation

tranquil sapphire
#

I got it, but thanks