How do I make a GUI open once for each player?

Started by Logdawg940 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make a GUI open once for each player?

So I made a GUI for when the player joins a world but the only problem is that it will always open when the player joins the world (if I'm correct by the way the procedure runs). I want it to run only once per player so the players don't run into it over and over again. Please help!

Joined Jun 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how would i do that?
Fri, 11/29/2019 - 19:03

how would i do that?

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Add this to your procedure,…
Fri, 11/29/2019 - 23:10

Add this to your procedure,

If {Get [EntityNBT - "loggedinbefore"] = 0}

     Then {Open the GUI}

      Then {Set [EntityNBT - ["loggedinbefore] to 1}

That way when the player joins again the if statement won't be true and the statement won't run

 

Joined Jun 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sorry I pasted the wrong…
Sat, 11/30/2019 - 14:43

Sorry I pasted the wrong thing
Like this?
if Get entity data logic NBT tag "loggedinbefore" = false

do Open GUI for the provided (entity)player: (GUI name)

then Set entity data logic NBT tag "loggedinbefore" = true

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes, did it work?
Sat, 11/30/2019 - 16:33

Yes, did it work?

Joined Jun 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I haven't tested it yet but…
Sat, 11/30/2019 - 19:20

I haven't tested it yet but I hope it works. Otherwise thank you so much.

Joined Jun 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It didn't work  
Fri, 12/06/2019 - 21:27

It didn't work

 

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Can you screenshot the…
Fri, 12/06/2019 - 23:42

Can you screenshot the procedure

Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey! I was trying to do…
Sun, 12/29/2019 - 17:40

Hey! I was trying to do something similar, and I found that you should make a global variable, and set it to world, so that way it doesn't show upon reentering the world, hope that helps!

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sure, but it won't work in…
Tue, 12/31/2019 - 19:06

Sure, but it won't work in multiplayer so I wouldn't use GLOBAL_WORLD. I would use GLOBAL_SESSION variables and/or NBT Tags.

Joined Apr 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nope don't use global…
Sat, 01/04/2020 - 05:58

Nope don't use global variables for stuff like that!

Global variables are binded globally and not per player which means that this gui will gonna open once and other players will be unable to open it

 

NBT's are used for everything now because they are more stable and they are both global and private depending on your needs.

 

Many blocks are using them for cooking timers or to store Forge Energy or RedFlux

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes but NBT tags are lost on…
Sat, 01/04/2020 - 06:02

Yes but NBT tags are lost on death so use them in conjunction with global variables.