Script - help needed

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)

Can you explain that with better detail?

Your message was deleted, I need an update, also please make your title more descriptive.

Well, I use the RankGun module. With this I would like to make it so that when a player has a certain amount of “Time” so from the leaderstats that the function RankGun.Promote(-userid-), however this does not work with Player.UserId. From that point I unfortunately do not get further.

Okay, I won’t provide help until the title of this topic is updated, it’s not descriptive enough.

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