Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a GUI appear only when a player joins for the first time?

I want to make a in-game tutorial.

It is where once a player joins for the first time it will show up but if they rejoin the game it wont show up again.

Kind of like what "Robeats!" has but instead of a cutscene its just a GUI.

This is my UI : https://prnt.sc/rg1pgd

(I don't have any clue where to start)

1 comment

0

Just as far as the GUI showing only once, you could do it several ways but adding a bool or some value would be an easy way of checking if a player completed the tutorial and you could datastore save it as well.

2 answers

you'll have to use a DataStore for this, check if the player already has existing data, and if not, the datastore will create new data for the player and you can add the code of cloning the GUI from preferably ServerStorage to the PlayerGui

This is just an example:

	local s, e = pcall(function()
		DataFromStore = DataStore("DataStore-" .. Player.UserId)
	end)
	
	if s then
		print("the player have existing data, Getting Data For: " .. Player.Name)
		if DataFromStore then
			print("Data Loaded For: " .. Player.Name)
		else
			print("Created New Data For: " .. Player.Name)
			--game.ServerStorage.Tutorial:Clone().Parent = Player.PlayerGui
		end
	else 
		warn("Error Getting Data For: " .. Player.Name)
	end
end)
local ds = game:GetService("DataStoreService"):GetDataStore("FirstJoin")
game.Players.PlayerAdded:Connect(function(plr)
	local key = "user_"..plr.UserId
	local data = ds:GetAsync(key) --Gets the player data
	if data then  --checks if the player have data
			warn(plr.Name.." is back :D")--Player have data
	else--Player dont have data
		warn(plr.Name.." is new!")
		warn("Creating Data for "..plr.Name)
		ds:SetAsync(key,1) --Create data
	end
end)


You need to use DataStoreService

This discussion is preserved as it was. New answers, comments, and votes are closed.