Search…
Plugins
Basic Admin Plugins for Hyra Ranking
This is a sample plugin to change a users rank with a Basic Admin plugin, utilising Hyra Ranking.
To install, simply add a ModuleScript into your Basic Admin Plugins folder. See image below.
You can name the script whatever you would like. Make sure you use a ModuleScript and not a normal script. ModuleScripts have a white/grey brick next to them in the icon.
Fixed Rank as Command Name
Using Rank as Argument
Please copy the script below and paste it into your Plugin ModuleScript
1
local Plugin = function(...)
2
local Data = {...}
3
4
local remoteEvent = Data[1][1]
5
local remoteFunction = Data[1][2]
6
local returnPermissions = Data[1][3]
7
local Commands = Data[1][4]
8
local Prefix = Data[1][5]
9
local actionPrefix = Data[1][6]
10
local returnPlayers = Data[1][7]
11
local cleanData = Data[1][8]
12
13
14
local pluginName = 'sa' -- Your Command Name (We've used "sa" for Staff Assistant, make sure it's lowercase and unique)
15
local pluginPrefix = Prefix -- Prefix for your default prefix (usually ":"), actionPrefix for "!"
16
local pluginLevel = 2 -- The level which can run the plugin, 0 = everyone, 1 = Moderator, 2 = Admin, 3 = Superadmin
17
local pluginUsage = "<User(s)>" -- Don't touch this unless you really need to
18
local pluginDescription = "Promotes a user to the next rank." -- Don't touch this unless you really need to
19
20
local token = "XXXXXXXXXXXXXXXXXXXXXXXXX" -- CHANGE THIS ⚠ - THIS IS YOUR TOKEN TAKEN FROM THE HYRA ADMIN - KEEP THIS SECURE
21
local rankToRankTo = 35 -- CHANGE THIS ⚠ - THIS IS THE RANK YOU WANT TO PROMOTE THE USER TO
22
local groupId = 1 -- CHANGE THIS ⚠ - THIS IS YOUR GROUP ID
23
24
local Ranking = require(4754168383) -- Require the module
25
26
local function pluginFunction(Args) -- keep the name of the function as "pluginFunction"
27
local Player = Args[1]
28
if Args[3] then
29
local Victims = returnPlayers(Player, Args[3]) if not Victims then return end
30
31
local combinedVictims = ''
32
for a,b in pairs(Victims) do
33
if combinedVictims == '' then
34
combinedVictims = b.Name
35
else
36
combinedVictims = combinedVictims..', '..b.Name
37
end
38
end
39
40
for a,b in next,Victims do
41
local Callback = Ranking.SetRank(token, b.UserId, groupId, rankToRankTo)
42
if Callback.Success == true then
43
remoteEvent:FireClient(Player,'Hint','Success',b.Name..' was ranked.')
44
else
45
remoteEvent:FireClient(Player,'Hint','Error',b.Name..' was not ranked.')
46
end
47
end
48
end
49
end
50
51
-- Return Everything to the MainModule --
52
local descToReturn
53
if pluginUsage ~= "" then
54
descToReturn = pluginPrefix..pluginName..' '..pluginUsage..'\n'..pluginDescription
55
else
56
descToReturn = pluginPrefix..pluginName..'\n'..pluginDescription
57
end
58
59
return pluginName,pluginFunction,pluginLevel,pluginPrefix,{pluginName,pluginUsage,pluginDescription}
60
end
61
62
return Plugin
Copied!
Usage:
:sa <User(s)>
Pease copy the script below and paste it into your Plugin ModuleScript
You will need to update your if/elseif statements for each rank you want as an argument. Then edit the rankToRankTo variable in each if
1
local Plugin = function(...)
2
local Data = {...}
3
4
local remoteEvent = Data[1][1]
5
local remoteFunction = Data[1][2]
6
local returnPermissions = Data[1][3]
7
local Commands = Data[1][4]
8
local Prefix = Data[1][5]
9
local actionPrefix = Data[1][6]
10
local returnPlayers = Data[1][7]
11
local cleanData = Data[1][8]
12
13
14
local pluginName = 'rank' -- Your Command Name (We've used "sa" for Staff Assistant, make sure it's lowercase and unique)
15
local pluginPrefix = Prefix -- Prefix for your default prefix (usually ":"), actionPrefix for "!"
16
local pluginLevel = 2 -- The level which can run the plugin, 0 = everyone, 1 = Moderator, 2 = Admin, 3 = Superadmin
17
local pluginUsage = "<User(s)> <Rank>" -- Don't touch this unless you really need to
18
local pluginDescription = "Promotes a user to the next rank." -- Don't touch this unless you really need to
19
20
local token = "XXXXXXXXXXXXXXXXXXXXXXXXX" -- CHANGE THIS ⚠ - THIS IS YOUR TOKEN TAKEN FROM THE HYRA ADMIN - KEEP THIS SECURE
21
local groupId = 1 -- CHANGE THIS ⚠ - THIS IS YOUR GROUP ID
22
23
local Ranking = require(4754168383) -- Require the module
24
25
local function pluginFunction(Args) -- keep the name of the function as "pluginFunction"
26
local Player = Args[1]
27
if Args[3] then
28
local Victims = returnPlayers(Player, Args[3]) if not Victims then return end
29
30
local combinedVictims = ''
31
for a,b in pairs(Victims) do
32
if combinedVictims == '' then
33
combinedVictims = b.Name
34
else
35
combinedVictims = combinedVictims..', '..b.Name
36
end
37
end
38
39
for a,b in next,Victims do
40
if Args[4] then
41
if string.lower(Args[4]) == "sa" then
42
local rankToRankTo = 35 -- CHANGE THIS ⚠ - THIS IS THE RANK YOU WANT TO PROMOTE THE USER TO
43
local Callback = Ranking.SetRank(token, b.UserId, groupId, rankToRankTo)
44
if Callback.Success == true then
45
remoteEvent:FireClient(Player,'Hint','Success',b.Name..' was ranked.')
46
else
47
remoteEvent:FireClient(Player,'Hint','Error',b.Name..' was not ranked.')
48
end
49
elseif string.lower(Args[4]) == "trainee" then
50
local rankToRankTo = 10 -- CHANGE THIS ⚠ - THIS IS THE RANK YOU WANT TO PROMOTE THE USER TO
51
local Callback = Ranking.SetRank(token, b.UserId, groupId, rankToRankTo)
52
if Callback.Success == true then
53
remoteEvent:FireClient(Player,'Hint','Success',b.Name..' was ranked.')
54
else
55
remoteEvent:FireClient(Player,'Hint','Error',b.Name..' was not ranked.')
56
end
57
end
58
end
59
end
60
end
61
end
62
63
-- Return Everything to the MainModule --
64
local descToReturn
65
if pluginUsage ~= "" then
66
descToReturn = pluginPrefix..pluginName..' '..pluginUsage..'\n'..pluginDescription
67
else
68
descToReturn = pluginPrefix..pluginName..'\n'..pluginDescription
69
end
70
71
return pluginName,pluginFunction,pluginLevel,pluginPrefix,{pluginName,pluginUsage,pluginDescription}
72
end
73
74
return Plugin
Copied!
Usage:
:rank <User(s)> <Rank>

Important!

Make sure you edit the following variables for your group:
  • pluginName - The command name
  • pluginLevel - The role which can use the plugin > 0 = Everyone, 1 = Moderator, 2 = Admin, 3 = Superadmin
  • token - Your Hyra Ranking token
  • rankToRankTo - The rank you wish to promote to, the numerical number between 1 and 255 taken from group admin
  • groupId - Your Group ID taken from the URL of your group
Feel free to modify the code to include some useful stuff. For example, a Discord webhook.
Code licensed under APACHE-2.0 License.
Copy link
Contents
Important!