If they haven't been in the game before, this will set it to true, but something else needs to happen if they haven't, my intro GUI handled by a separate localscript. How exactly would I get this to work? I'm sort of being braindead at the moment and confused. Help, please?
local player = script.Parent.Parent.Parent.Parent local datastoreservice = game:GetService("DataStoreService"):GetDataStore("BoE_BeenBefore") local beenbefore game.Players.PlayerAdded:connect(function() if datastoreservice:GetAsync(player.userId) == false or nil then script.Parent.beenbefore.Value = false datastoreservice:SetAsync(player.userId,true) elseif datastoreservice:GetAsync(player.userId) == true then script.Parent.beenbefore.Value = true end end)
Couple of things:
The key of a datastore must not be the player's userId; plain. So you can add a "player_" or "user_" in front of the id. Also, make sure the userId is greater than 0, this means the player is a guest.
if plyr.userId > 0 then DS:SetAsync("user_"..plyr.userId, 173821) end
Updates the async.
DS:UpdateAsync("user_"..plyr.userId, function() return true --return the value you want it to change to. end)
SetAsync is like GetAsync but there is another argument, the value you are setting it to.
DS:SetAsync("user_"..plyr.userId, 173821)
local datastoreservice = game:GetService("DataStoreService"):GetDataStore("BoE_BeenBefore") game.Players.PlayerAdded:connect(function(player) --You didn't need line 1, just do this instead. if datastoreservice:GetAsync("user_"..player.userId) == nil then datastoreservice:SetAsync("user_"..player.userId, false) elseif datastoreservice:GetAsync("user_"..player.userId) == false then datastoreservice:SetAsync("user_"..player.userId, true) end end)
Hope it helps!