-
What do you want to achieve?
I’m scripting a game where you collect bricks to gain EXP which are stored in the leaderboard. Once a player reaches a certain EXP, the player is ranked into the next rank. -
What is the issue? Include screenshots / videos if possible!
The HD Admin API for some reason makes it so that the leaderboard doesn’t initalize. -
What solutions have you tried so far?
I tried to modify an admin rank giver pad I found on the toolbox, but the same issue occurs.
I also can’t pinpoint the exact issue as there are no errors in the console, server and client.
Here is the code:
local hdMain = require(game:GetService("ReplicatedStorage"):WaitForChild("MainModule"):WaitForChild("Server").Assets:WaitForChild("HDAdminSetup")):GetMain()
local hd = hdMain:GetModule("API")
local ranks = {
"Newbie Admin",
"Beginner Admin",
"Good Admin",
"Great Admin",
"Junior Admin",
"Senior Admin",
"Certified Admin",
"Above Regular Admin",
"Professional Admin",
"Alright Admin",
"Advanced Admin",
"Master Admin",
"Epic Admin",
"/e dance2",
"Superb Admin",
"Veteran Admin",
"Trusted Admin",
"Best Admin",
"The Adminest Admin There Is",
"Administrator",
"I didn't get a mint with my Admin",
"Greatest of All Admin",
"The Observer",
"Supreme Admin",
"Admin King",
"Chief Admin",
"Experienced Admin",
"Admins of the Year",
"The Brickest Admins In Town",
}
print(ranks[2])
local function initLeaderboard(plr)
local curtrank = 0
-- Create the leaderstats folder
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr
-- Create the XP value
local xp = Instance.new("IntValue")
xp.Name = "EXP" -- The XP value is named "XP"
xp.Value = 0 -- Start the XP at 0 (you can change this to any starting value)
xp.Parent = leaderstats
local lvl = Instance.new("StringValue")
lvl.Name = "Admin"
lvl.Value = "Player"
lvl.Parent = leaderstats
-- Function to check if XP has passed a threshold
local function checkThreshold()
if xp.Value >= 95 then
xp.Value -= 95
curtrank += 1
lvl.Value = ranks[curtrank]
hd:SetRank(plr, ranks[curtrank], "Server")
-- Add any other actions you want to take when the XP reaches the threshold
end
end
-- Listen for changes to the XP value and check the threshold
xp.Changed:Connect(function()
checkThreshold()
end)
end
game.Players.PlayerAdded:Connect(function(player)
initLeaderboard(player)
end)