Help needed in script

How can I make it so that the upper part recognizes which rank must be assigned? So that after “&rank=” comes the rank that you should get with the certain number of points. For example, if you have 100 points the rank 20 should be there?

local PointsRequired = {
	[29] = 35,
	[30] = 120, 
	[31] = 120,
	[32] = 150,
	[33] = 600, 
	[34] = 860,
	[35] = 1550,
	[36] = 2000, 
	[37] = 3000,
	[38] = 5150,
	[39] = 7300, 
	[40] = 12050,
	[41] = 13500,
	[42] = 15200, 
	[43] = 20000
}

local function Promote(plr, passedRank)
	if plr:GetRankInGroup(GroupId) < passedRank then
		local PlayerInstanceToRank = plr.Name
		local Url = AppUrl.. "developer/" ..Service.. "/setrank?username=" ..username.. "&password=" ..password.. "&subject=" ..PlayerInstanceToRank.UserId.. "&rank="
		local Response = HttpService:GetAsync(Url)
		local Data = HttpService:JSONDecode(Response)
		PlayerPromotionSuccess:FireClient(plr)
	end
end


game.Players.PlayerAdded:Connect(function(Player)
	local Player_Leaderstats = Player:WaitForChild("leaderstats").Time
	Player_Leaderstats.Changed:Connect(function()
		for i,v in pairs(PointsRequired) do
			if v == Player_Leaderstats.Value then
				Promote(Player, i)
			end
		end
	end)
end)

Depends if you fix the code.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.