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

How would i tell if a player joins for the first time?

Asked by 9 years ago

I want to make a tutorial thing for first time players, but how would I tell if it is their first time joining my game?

0
You would need to either save the players name, ID or a value within the player to a DataStore and then when they join have a script check the player with the store. I'm not very familiar with DataStores so you'd have to go and look this up Uroxus 350 — 9y

1 answer

Log in to vote
2
Answered by 9 years ago

If this works +1 and accept please

Ideaology

So you want to check if it's the players first time joining eh? Well the ideaology behind it is saving a value this value could be an int,string,bool but as long as it's there it shows that the player has been there. For server checks that stay in the server it could be as simple as making a model and checking if theres anything in there saying that player has joined.

modelcheck = game.Workspace.ModelCheck
game.Players.PlayerAdded:connect(function(player)
    if modelcheck:FindFirstChild(player.Name) == nill then
        check = Instance.new('BoolValue')
        check.Name = player.Name
        check.Parent = modelcheck
    elseif modelcheck:FindFirstChild(player.Name) ~= nill then
        print("Player's not first time here")
    end
end)

Ideaology for the entireity of your game

So, server for the entire game is a little different, you would need to save the value over all your servers. For this you would use a form of data persistance I usually use data store.

local DataStore = game:GetService("DataStoreService"):GetDataStore("Points")
game.Players.PlayerAdded:connect(function(player)
    key = player.Name
    if DataStore:GetAsync(key) then
    print("Player Exists")
    else
    print("Player Doesn't Exist")
    DataStore:SetAsync(key, true)
end
end)
Ad

Answer this question