I am trying to create a list of online Admins.
I have a list of problems, I’ve spent days researching but I have no idea what I’m doing.
-
When an admin joins, it removes all current players in the admin list and only puts the admin that just joined.
-
I am trying to make it so that when an admin leaves, it keeps everyone else on the admin list besides the admin that just left.
-
Trying to get the group rank of a player and displaying it on the list, but I wanna worry about that later.
There are 2 admins in the game, but only 1 shows and it was the admin that last joined.
LocalScript for AdminList
--> Main Locals <--
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunAdminList = ReplicatedStorage.Admin:WaitForChild("RunAdminList")
local httpsService = game:GetService("HttpService")
local Frame = script.Parent
local GroupId = 6442622
local Players = game:GetService("Players")
--> Online Admin List <--
local plrList = Frame:WaitForChild("AdminPlayerList")
local plrChosen = nil
RunAdminList.OnClientEvent:Connect(function(AdminPlayer)
for i, child in pairs(plrList:GetChildren()) do
if child:IsA("Frame") then child:Destroy() end
end
local admin = script.AdminFrame:Clone()
local adminlistTable = {}
table.insert(adminlistTable, AdminPlayer)
for i, admins in pairs(adminlistTable) do
local adminsId = Players:GetUserIdFromNameAsync(admins)
local userId = adminsId
local profile = game.Players:GetUserThumbnailAsync(userId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size60x60)
admin.AdminProfile.Image = profile
admin.AdminName.Text = admins
admin.Parent = plrList
end
--RunAdminList:FireServer(AdminPlayer)
--[[local data = httpsService:GetAsync("https://groups.roproxy.com/v2/users/{userId}/groups/roles")
for i, v in ipairs(data) do
if v.group.id == GroupId then
if v.role.id == 255 then
admin.GroupRank.Text = "🍓Owner🍓"
elseif v.role.id == 253 then
admin.GroupRank.Text = "🔨Developers🔨"
elseif v.role.id == 252 then
admin.GroupRank.Text = "🚨Moderators🚨"
end
end
end--]]
end)
The location of the script and frame for the list.
Script for MessagingService
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage.Admin:WaitForChild("RunAdminList")
local MessagingService = game:GetService("MessagingService")
local TextService = game:GetService("TextService")
local Players = game:GetService("Players")
local httpsService = game:GetService("HttpService")
local GroupId = 6442622
Players.PlayerAdded:Connect(function(player)
if player:GetRankInGroup(GroupId) == 255 or player:GetRankInGroup(GroupId) == 253 or player:GetRankInGroup(GroupId) == 252 then
local playerID = player.UserId
local text = playerID
local filteredTextResult = TextService:FilterStringAsync(text, playerID)
local message = player.Name
MessagingService:PublishAsync("GetAllAdmins", message)
end
end)
MessagingService:SubscribeAsync("GetAllAdmins", function(message)
print(message.Data)
print(message.Sent)
event:FireAllClients(message.Data)
end)
event.OnServerEvent:Connect(function(AdminPlayer)
local data = httpsService:GetAsync("https://groups.roproxy.com/v1/groups/{groupId}/roles/{roleSetId}/users")
local admin = script.Parent.Parent.StarterGui.AdminPanel.Output.Home.HomeScript.AdminFrame
for i, v in ipairs(data) do
if v.group.id == GroupId then
if v.role.id == 255 then
admin.GroupRank.Text = "🍓Owner🍓"
elseif v.role.id == 253 then
admin.GroupRank.Text = "🔨Developers🔨"
elseif v.role.id == 252 then
admin.GroupRank.Text = "🚨Moderators🚨"
end
end
end
end)
The location of the script is in ServerScriptService
I hope anyone can help me out with this, I’ve been working on this for over 8 hours now. I’m still an amateur at scripting and this is my first time using MessageService. Thanks!