What do you want to achieve?
I’m making a tutorial/character selection system. I need…
A GUI that does the following:
Appears only ONCE - this means that the first time the player joins the game, the GUI will appear, however the next time they join it won’t appear.
*The GUI also only disappears forever if you click button inside the GUI, like accept etc…
What is the issue?
I have no clue where to start, due to lack of experience with these things.
What solutions have you tried so far?
None so far. I haven’t seen anything on DevForum. I was thinking about storing a string value or bool to the player with DataStore but this may be inefficient…
Thank you for your help. I’ll flag you as the solution if it works!
@N0tA_G4m3r0nYT you must really regret your past self for that username , not that i’m any better (do NOT look at my past usernames)
but yes, datastores i think, can’t think of anything else
by default, there should be some sort of boolean stored in the datastore, that gets set to false whenever the player clicks the first-time GUI, i think that’s the only way
Wdym my past self? my current username is just my yt username (im taking all the usernames close to it to avoid fake users lol) but yes using a Boolean and a remote event is the best way
ResetOnSpawn is one of the options in the GUI’s properties. Uncheck that and it will only run the first time they log in. (Click on your GUI, look over at the properties window… uncheck ResetOnSpawn)
store the gui in ReplicatedStorage or ServerStorage and clone it to the player’s PlayerGui
local playerService = game:GetService("Players")
local dss = game:GetService("DataStoreService")
local datastore = dss:GetDataStore("Anything here works")
local serverStorage = game:GetService("ServerStorage")
local gui = [path_to_gui]
playerService.PlayerAdded:Connect(function(plr)
local tempData
local success, errMsg = pcall(function()
tempData = datastore:GetAsync(plr.UserId..'data')
end)
if success and tempData then
--Player has played the game before
--load other data or sm
else
--If player is new
local newGui = gui:Clone()
newGui.Parent = plr.PlayerGui
datastore:SetAsync(plr.UserId..'data', true)
end
end)
wrote this in the forum so there might be errors and bad optimization but this is basically how it should work
If you’re not relying on datastores for anything else, you can just use a welcome badge for this. When someone without the badge joins, show the GUI and award that badge. Only problem is that players can force it to show again by removing it from their inventory.