How can I make a UI That stays only once

Hello! How can I make a UI That only shows up once? Let’s say there was an update GUI, and you join, close it, and rejoin, it won’t show it anymore. How can I do that?

If you know, it’ll be appreciated!

Generally you would use DataStores to save whether a player has played before.

Try something like this:

local DataStoreService = game:GetService("DataStoreService")

local YourDataStore = DataStoreService:GetDataStore("YourDataStore")

		if not YourDataStore:GetAsync(player.UserId) then
			-- Do stuff that only executes once (show the ui in your case)

Always wrap DataStore updates inside a pcall in case the service fails, so that you can retry.

Pcall does not retry, it just silences any errors and returns them as a function.
But yes, edited!

It is recommended practice to wrap DataStore updates inside a pcall. DataStoreService can fail.

I know, that’s true, but I you said that they retry and thats wrong: they only silence the error.

i think this is it

I didn’t say that pcall directly retries, I insinuated that a pcall error should be met with another attempt in good game development.

1 Like