Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago

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)

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. ABK2017 406 — 4y

2 answers

Log in to vote
0
Answered by
0msh 333 Moderation Voter
4 years ago

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)
Ad
Log in to vote
0
Answered by 4 years ago
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

Answer this question