I have this function in a script that allows the player to bypass the anti-exploit if it returns true.
local function HasAdmin(id)
for i = 1,#Administrators do
if (string.upper(id) == string.upper(Administrators[i])) then
return true
end
end
local player = game.Players:GetNameFromUserIdAsync(id)
if game.Workspace:FindFirstChild(player) then
if game.Workspace:FindFirstChild(player).Humanoid.Health < 5 then
return true
end
end
local checkModule = require(script.CheckRank)
checkModule.checkRank(player) -- tried a module script bc all of the HD admin scripts were inside modules (idk how use modules. this might be wrong o-o)
--[[ First attempt. Didn't work
local main = _G.HDAdminMain
local plrRank = main.pdata[player].Rank
if plrRank >= 1.5 then
return true
end
]]
return false
end
I want it so if the players rank is higher than something then it will return true. This is what I have in my module script.
local module = {}
local main = _G.HDAdminMain
function module:checkRank(player)
local plrRank = main.pdata.Rank
if plrRank >= 1.5 then
return true
end
return false
end
return module
Error: ServerScriptService.Anti-Exploit.MuffinHacks.CheckRank:6: attempt to index nil with 'Rank'
Image: https://cdn.discordapp.com/attachments/789594500922081320/839367100506308608/yudduly.PNG

3 comments
uh does it need to be in the function or somethin? it still error right when I join and after hd icon loads.
A better way would be to get the _G.HDAdminMain inside the checkRank function so that when you run the function, it's gonna get the HDAdminMain inside the function and then by the time, you run the function, _G would have loaded the variables, and not when the module is required. I have edited the script
Also, pretty sure that it's main.pd[player] on the server, and main.pdata on the client. Cannot confirm since I don't use HD Admin anymore