Is it possible to check if a player is online, and in your game?
I've got a system, but it's not working the way I wanted it too.
local function savePlayerData(player) if sessionData[player] then return dataStoreRetry(function() return FriendData:SetAsync(player.userId, sessionData[player]) end) end end local function setupPlayerData(player) local success, data = getPlayerData(player) if not success then sessionData[player] = false else if not data then sessionData[player] = {} savePlayerData(player) else sessionData[player] = data end end end function DataStore:UpdateStatus(player, isOnline) for i = 1, #sessionData[player] do local friendID = game.Players:GetUserIdFromNameAsync(sessionData[player][i]["Name"]) if friendID ~= nil then output(player, ":", friendID) end local playerData = FriendData:GetAsync(friendID) if playerData ~= nil then for i2 = 1, #playerData do for i3 = 1, #playerData[i2] do if playerData[i2][i3]["Name"] == player.Name then playerData[i2][i3]["Online"] = isOnline end end end FriendData:SetAsync(game.Players:GetUserIdFromNameAsync(sessionData[player][i]["Name"], playerData)) end end end game.Players.PlayerAdded:connect(function(plr) setupPlayerData(plr) DataStore:UpdateStatus(plr, true) end) game.Players.PlayerRemoving:connect(function(plr) DataStore:UpdateStatus(plr, false) savePlayerData(plr) end)