i want to save when a player first joins and then a gui pop's up, and when they join back again the gui doesn't pop up. anyone know how to do that? i was gonna use DataStores but i dont know how to use them that well, please help me thanks.
COMMUNITY QUESTION
how can i save when a player first joined?
1 answer
local DataStoreService = game:GetService("DataStoreService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local JoinData = DataStoreService:GetDataStore("JoinData")
local JoinPopup = ReplicatedStorage:WaitForChild("JoinPopup")
local function CheckIfJoined(Player)
local Success, Response = pcall(JoinData.GetAsync, JoinData, Player.UserId)
if (Success) then
local Joined = select(1,unpack(Response))
if not (Joined) then
JoinPopup:FireClient(Player)
SetJoinData(Player)
end
else
warn(Response)
end
end
local function SetJoinData(Player)
local JoinInformation = {
Joined = true;
Date = os.date('%x');
UnixTimeStamp = tick()
}
JoinData:SetAsync(Player.UserId, JoinInformation)
end
Players.PlayerAdded:Connect(CheckIfJoined)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Check out AlvinBlox's tutorial on DataStores, then on client check for a value called for example "FirstJoined" and if it's true then when a player click the button it's being changed to false and saved.