I am working on a rank command, I already have the script to rank, I just want to intergrate it with Basic Admin.
How would I go about doing this? I know you use plugins, but I’m new to this.
Any help appreciated.
Rank script
local Ranking = require(4754168383)
local key = "0000000000000"
local groupInfo = game:GetService("GroupService"):GetGroupInfoAsync(6688067)
local playersService = game:GetService('Players')
playersService.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if plr:GetRankInGroup(6688067) >= 13 then
local strRes = string.find(msg, ':rank ')
if strRes == nil then
return
else
local command = string.gsub(msg, ':rank ', '')
local parsed = parseMessage(command)
local rank = ''
local rankTab = {}
for i = 2, #parsed do
table.insert(rankTab, parsed[i])
end
for i, v in ipairs(rankTab) do
if i == 1 then
rank = v
else
rank = rank .. ' ' .. v
end
end
local username = parsed[1]
local id = ''
pcall(function()
id = game:GetService('Players'):GetUserIdFromNameAsync(username)
end)
for _, role in ipairs(groupInfo.Roles) do
if role.Name == rank then
local promise = Ranking.SetRank(key, id, 6688067, role.Rank)
if promise.Success == true then
print('Success, ranked user')
else
print(promise.Message)
end
end
end
end
else
wait(1)
end
end)
end)
wait(5)
for i, plr in ipairs(playersService:GetPlayers()) do
plr.Chatted:Connect(function(msg)
if plr:GetRankInGroup(6688067) >= 13 then
local strRes = string.find(msg, ':rank ')
if strRes == nil then
return
else
local command = string.gsub(msg, ':rank ', '')
local parsed = parseMessage(command)
local rank = ''
local rankTab = {}
for i = 2, #parsed do
table.insert(rankTab, parsed[i])
end
for i, v in ipairs(rankTab) do
if i == 1 then
rank = v
else
rank = rank .. ' ' .. v
end
end
local username = parsed[1]
local id = ''
pcall(function()
id = game:GetService('Players'):GetUserIdFromNameAsync(username)
end)
for _, role in ipairs(groupInfo.Roles) do
if role.Name == rank then
local promise = Ranking.SetRank(key, id, 6688067, role.Rank)
if promise.Success == true then
print('Success, ranked user')
else
print(promise.Message)
end
end
end
end
else
wait(1)
end
end)
end
function parseMessage(msg)
local t = string.split(msg, ' ')
return t
end