How to make a 1 time only gui?

Hello! It’s been some months since I came up with this idea but could never figure out how to do it. Basically what I need is to make a GUI That only appears the first time the user joins the game, and when the user leaves and comes back the GUI doesn’t appear. I made a leaderstat called WelcomeValue (with datastore) wich when it’s value is “0” the gui will pop up, and when the value is “1” the gui will not pop up again, and to my surprise the button that gives the value the number 1 works. However, when I leave and join back, the GUI appears again, and the value is resetted to 0. Here’s a clip of what I’m expecting:


I hope you can help, as I’ve been looking in Google, YouTube, and ScriptingHelpers but nothing showed up.

3 Likes

You’ll need to utilize datastores for your gui to be successful in this way. This way, the gui will only appear for new players.

EDIT: Also, to avoid issues with respawning, make sure the gui property “ResetOnSpawn” is disabled.

2 Likes

Hello! I’m actually already using a DataStore, here are my scripts:

I hope the DataStore script isn’t deprecated, but I don’t think so, as the Script Debugger doesn’t pause the game when I test it.

I would check the link I provided above for a proper example. I can see you’re missing pcalls which is important.

You need to use DataStores and possibly save a value ‘Played’ and set it to false by default and true once a player joins, check that to see whether a player’s an old or new player and respectively display the Gui.

Alternatively, you could just check for whether any other saved data is not default; this would mean a player’s played before.

1 Like

You should put a remote event to change the value since LocalScripts can’t change the server.

1 Like

I think you might be right, one of the things I did was change the value using a localscript, wich apparently doesnt make the datastore work. ill try to use the remote event

Hello! I’m wondering how could I make the remote event change the value? I tried making the LocalScript fire the Remote Event, then a Server Script in ServerScriptService would change the value. However, I keep getting this error:

Apparently, everytime I try to access to something inside the player via Server Scripts, (character, backpack, leaderstats, etc) I get this error. I’d like if you could help!

Edit: I also tried doing “local leaderstats”, and “local welcomevalue” but it didn’t work. even if I used ‘:WaitForChild(“leaderstats”)’ it would not work

Are you doing all of this in a server script or localscript?

I made a local script in a gui button that fires a remote event when clicked, then the server script that’s supposed to change the value gives me this error when i test:

You can’t do game.Players.LocalPlayer in a serverscript
When the remote event is called, it gives you the player that fired the event, thats the first parameter so change local function onCreatePart() to local function onCreatePart(plr) and get rid of the game.Players.Localplayer

3 Likes

Using DataStore, you can set a BoolValue when a player is joining the game for the first time, and make a check through the GUI script that detects if value is true or false (New player or not) and make the GUI appear then.

Change the BooleanValue to true so next time the player joins it doesn’t trigger the GUI script.