how would I find the value in a dictionary that's closest to the money that player has? for example,if a player has 25 money I want them to be ranked as "Experienced" but when they have 51 money I want them to be ranked as "Advanced".
local ranking = {
["Rook"] = 0,
["Experienced"] = 20,
["Advanced"] = 50,
["Multimillionaire"] = 100,
["Roblox"] = 200
}
game.Players.PlayerAdded:Connect(function(plr)
local PlayerRank = plr.StatFolder.Money
for i,v in next, ranking do
if PlayerRank.Value >= v then
plr.leaderstats.Rank.Value = i
end
end
end)
