So I have a script that adds players and bans them based on input from an admin to a gui. But I wanna make a list of all the globally banned players, which I cant seem to figure out with roblox’ help websites. Basically, How could I get a list of all players in my datastore and put them in a useable format for a UI list layout inside a scrolling frame.
local bandata = datastoreservice:GetDataStore("TimedBans")
script.Parent.Parent.SecondFrame.Ban.OnServerEvent:Connect(function(plr,plrtoban,reason,days,hours,minutes,timemsg)
wait(0.1)
local uid = game.Players:GetUserIdFromNameAsync(plrtoban)
local ostime = os.time()
local days = tonumber(days)
local hours = tonumber(hours)
local minutes = tonumber(minutes)
local d = (days or 0) * 86400
local h = (hours or 0) * 3600
local m = (minutes or 0) * 60
local combine = d + h + m
if combine == 0 then
combine = 9223372036854775807
end
local length = combine + ostime
local table2 = {uid,length,reason}
bandata:SetAsync(uid,table2)
wait(1)
if game.Players:FindFirstChild(plrtoban) == nil then
print("Not in server")
else
game.Players:FindFirstChild(plrtoban):Kick("You have been banned\n For: ".. reason .." Time ".. timemsg .."")
end
end)```