A script to check new players

When Creating a Game What script do I have to use to check if a player is a new player so I am making a game I need a script to check if they are a new player if they are a new player a gui will pop giving instructions on how to play a game but if the player has already joined the game I dont want the gui to pop up

It’s simple. If you have a datastore you can check to see if the player has data if there isn’t data then that means the player is new.

1 Like

Use data stores. Save true when a player leaves, so when they come back again they aren’t new anymore. However new players won’t have any data on them, so if they don’t, they are likely new.

Roblox has a neat article on data stores, check it out.

1 Like

you can do something like this:

local ds = game:GetService("DataStoreService")
local joined = ds:GetDataStore("Joined")

game.Players.PlayerAdded:Connect(function(player)
    local hasjoined = joined:GetAsync(player.UserId) or false
    if not hasjoined then
        --code here
        joined:SetAsync(player.UserId, true)
    end
end)
4 Likes

As everyone else is saying, use DataStoreService to store a NewPlayer value in the player. When a player joins, check if the players value is false. If it’s false, the player is not a new player. If the NewPlayer value is true then, the player is new.

3 Likes