This script makes a key and adds it to the dataStore along with the player’s ID
local DataStore = game:GetService("DataStoreService")
local Classes = DataStore:GetDataStore("1234")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Player = game.Players:GetPlayers()
-- Creating a class
local function createCode(Player, code)
local code = code
members = Classes:GetAsync(code)--Check if the code is already in use
if not members then
Classes:SetAsync(code, {Owner = Player.UserId, Members = {}})
print("There are no members")
return true
else
--Tell the user the code is taken, class codes must be unique
return false
end
end
What’s the best way to make a gui that shows all of the keys the player is in when the player rejoins.
The only option I can think of is looping through all of the keys and checking if the player is indexed in one of them, but that would reach the datastore limits. What are you thoughts?