Okay! We use RoManager (no not our service yet!)
And its not working.
Can anyone help me?
--!nolint UnknownGlobal
--[[
RoManager In-Game Commands
ADONIS ONLY
]]--
-- Your API key (generate one with the .apikey generate command)
local API_KEY = 'private'
-- Your Group ID (make sure to change this - incorrectly setting this may result in unexpected behavior)
local GROUP_ID = 14024613
-- Whether or not to check if the user running the command has permission to change ranks
local CHECK_PERMISSIONS = true
--------------------------------
local baseUrl = 'https://api.romanager.jaydensar.net/v1'
local http = game:GetService('HttpService')
local group = game:GetService('GroupService'):GetGroupInfoAsync(GROUP_ID)
print('[RoManager Plugin] Using group '.. group.Name ..' ('.. group.Id.. ')')
local function getMatchingRole(roleInput, plr)
local group = game:GetService('GroupService'):GetGroupInfoAsync(GROUP_ID)
local groupRank = plr:GetRankInGroup(GROUP_ID)
if (string.len(tonumber(roleInput) or '') == string.len(roleInput)) then
for _,role in ipairs(group.Roles) do
if role.Rank == tonumber(roleInput) then
if CHECK_PERMISSIONS then
if not (role.Rank >= groupRank) then
return role
end
else
return role
end
end
end
end
for _, role in ipairs(group.Roles) do
if string.match(string.lower(role.Name), string.lower(roleInput)) then
if CHECK_PERMISSIONS then
if not (role.Rank >= groupRank) then
return role
end
else
return role
end
end
end
end
return function()
server.Commands.RoleCommand = {
Prefix = server.Settings.Prefix;
Commands = { 'role', 'setrole', 'setrank' };
Args = { 'player', 'role' };
Description = '[RoManager] Assigns a role to a member';
AdminLevel = 'Players';
Function = function(plr, args)
assert(args[1], 'You must provide a player to role.')
assert(args[2], 'You must provide a role to assign.')
local userGroupPermissions = http:JSONDecode(http:RequestAsync({
Url = baseUrl..'/permissions/'..plr.UserId,
Method = 'GET',
Headers = {
Authorization = API_KEY
},
}).Body)
if CHECK_PERMISSIONS then
assert(userGroupPermissions.groupMembershipPermissions.changeRank, 'You do not have the Manage lower-ranked member ranks permission.')
end
local role = getMatchingRole(args[2], plr)
assert(role, 'Could not find a role matching '.. args[2].. '.')
for _,splr in pairs(service.GetPlayers(plr, args[1])) do
local splrGroupMemberships = http:JSONDecode(http:GetAsync('https://groups.rprxy.xyz/v1/users/' ..splr.UserId.. '/groups/roles')).data
local splrRank
for _,groupMembership in ipairs(splrGroupMemberships) do
if groupMembership.group.id == GROUP_ID then
splrRank = groupMembership.role.rank
end
end
if CHECK_PERMISSIONS then
assert(splrRank, 'Unable to get the group role of '.. splr.Name.. '.')
if (splrRank >= plr:GetRankInGroup(GROUP_ID)) then
continue
end
end
local ans = server.Remote.GetGui(plr, 'YesNoPrompt', {
Question = 'Are you sure you want to role '.. splr.Name.. ' (' .. splr.UserId.. ') to '.. role.Name .. '?';
})
if ans == 'Yes' then
http:RequestAsync({
Url = baseUrl.. '/role/'.. splr.UserId,
Method = 'PATCH',
Headers = {
['Content-Type'] = 'application/json',
['Authorization'] = API_KEY
},
Body = http:JSONEncode({
roleName = role.Name
})
})
end
end
end
}
end
I am unsure, do i send the developer console logs?
Noah
4
Do you know how to debug - if not I would highly reccommend reading a guide on it.
Cookie, Oh my god thanks for your help! I will try this now.
I think rproxy is something to do with adonis LOL
Noah
6
Remember to also use the output, a very important feature:
Output
The Output window, accessible from the View tab, displays errors captured from running scripts, messages from Roblox Engine, messages from calls to print(), and errors from calls to warn(). For more information on the Output window and how to customize it, see Output.
system
Closed
7
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.