How would i be able to retrieve a ban datastore with the banned players id and the admin who banned the players id

i need to do so because some exploiter has been bypassing our anti cheat.

ive already tried to save the admins id being the plr.UserId but i have no clue on how to retrieve the admins id from the datastore

			local success, errormessage = pcall(function()
				banDataStore:SetAsync(id, true, plr.UserId)
			end)

ive tried checking the forums and havent found anything

if someone could answer this topic it would be a really great help.

You used the third argument of the function incorrectly. The third argument, also known as userIds is a

Table of UserIds, highly recommended to assist with GDPR tracking/removal.

Default Value: “{}”

Then, when getting the data, add a second variable to retrieve the DataStoreKeyInfo on the same line, and call :GetUserIds() on it.

I suggest when the player is banned creating a table of the data

Here’s an example

function banuser(admin, plr)
    local data = {}
    data.AdminID = admin.UserId
    data.PlayerID = plr.UserId
    local success, errormessage = pcall(function()
        banDataStore:SetAsync(data, plr.UserId)
              end)
end

function RetrieveIds(playername)
    local data = nil
    local success, errormessage = pcall(function()
        data = banDataStore:GetAsync(game:GetService("Players"):GetUserIdFromNameAsync(playername))
    end)
    if success then
        return data
    else
        return false
    end
end

The RetrieveIds function uses the players username as a parameter and returns the data table that was saved. Here’s an example of using it

local data = RetrieveIds("ExampleName")
local adminid  = nil
local playerid = nil
if data ~= false then
    adminid = data.AdminID
    playerid = data.PlayerID
end