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
I have looked through the code of HDAdmin. One reason your script isn't working is because your script runs before _G assign HDAdminMain to the MainFramework, and also because the data for the server is stored in main.pd[player]
local module = {} function module:checkRank(player) local main = _G.HDAdminMain local plrRank = main.pd[player].Rank print(plrRank) -- Prints 5 for owner if plrRank >= 1.5 then return true end return false end return module