Trying to create a gui that lists banned players

I’m currently trying to create a ban-land system which shows all the players banned.

An example of this ban-land system is HD-Admin’s ban-land system which shows the banned players.

The banned players are stored with player-ids although I’m not sure how to get a list of these player ids.

1 Like

There are many tutorials on this like on lua learning there is a ban player list. Also theres a plugin for this script that @Ozzypig had created, the following topic links to the plugin:

Could you perhaps link one of the tutorials? I can’t seem to find any.

And also, I’m currently trying to create a list of banned users instead of a playerlist of players to ban or a remote banning system.

You should make them link to the datastore from the banned users and list each individual.

yeah datastores should be like one of the first things you handle in your game.
(if data saving is needed)

once you understand datastores and got your banned list working you can just do something like…

local list = {}

local success, err  = pcall(function()
    list = datastore:GetAsync("BannedList")
end)


if(success)then
    for i, v in ipairs(list) do
         local name = v.Name
         local userId = v.UserId
         
         -- now use all the data you saved to visualize the list. (using a scrollframe with a listLayout)
   end
end

you can send the data over to the client with remote events. (or you can just update the PlayerGui directly from the server, i never noticed any difference in speed)

You could use a remotefunction to grab the list of banned players. To make a list of banned players first you must access the ‘ban’ datastore. To make a datastore is simple this is legit all you have to do:

local Data = game:GetService("DataStore"):GetData("BanList")
function BanPlayer(UserId)
if Data:GetAsync("BannedPlayers") then
local bannedPlayers = Data:GetAsync("BannedPlayers")
bannedPlayers[UserId]=true
Data:SetAsync("BannedPlayers", bannedplayers)
else
bannedplayers = {}
bannedplayers[UserId]=true
Data:SetAsync("BannedPlayers", bannedplayers)
end
end

that function you can run when you ban anyone. then you can make another function to grab the list of players here:

local remotefunction = game.ReplicatedStorage:WaitForChild("BanRemote") -- remotefunction
remotefunction.OnServerInvoke = function()
local data = Data:GetAsync("BannedPlayers")
if data then
return data
end
end

so what does the function above do exactly? what it does is when you invoke the server from the client that script will return the table of banned players back to you. you can then from there on make a for loop instancing textlabels with whatever you want into a frame with ‘UIListLayout’ inside of it. Make sure to clear the frame whenever you want to refresh though!