Need help with ranks comparing with levels

You see, I’m having this problem with ranks changing when you level up in a game.

This is how it looks like:

local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player

local Rank = Instance.new("StringValue")
Rank.Name = "Rank"
Rank.Parent = leaderstats
Rank.Value = "Novice"

local level = Instance.new("NumberValue", player)
level.Name = "Level"
level.Parent = leaderstats
level.Value = 1

level.Changed:Connect(function()
	if level.Value >= 2 then
		Rank.Value = "Not-So-Noob"
	elseif level.Value >= 4 then
		Rank.Value = "Beginner"
	elseif level.Value >= 6 then
		Rank.Value = "Advanced Novice"
	elseif level.Value >= 9 then
		Rank.Value = "Potential Expert"
	elseif level.Value >= 11 then
		Rank.Value = "Expert"
	elseif level.Value >= 14 then
		Rank.Value = "Competitive Expert"
	elseif level.Value >= 19 then
		Rank.Value = "Pro"
	elseif level.Value >= 23 then
		Rank.Value = "Competitive Pro"
	elseif level.Value >= 29 then
		Rank.Value = "Future Champion"
	elseif level.Value >= 49 then
		Rank.Value = "The Elite One"
	end
end)

The point is that when I test it, it just stays on Not-So-Noob for my rank (I set my level on level 5 to test it).

RobloxScreenShot20220426_185010144

is it a local script/serverscript and where did u put it in?

Your code is first checking if the value is greater than 2, which is likely to be true. since this first statement is true it stops checking and doesn’t run any elseif or else. You could replace elseif with end if or flip your comparisons so that 49 is first down to 2.

1 Like

I placed it in a regular script for my leaderstats in ServerScriptService.

what @gertkeno said lol do that replace and fix ur script stuff

It works! Thanks for your help.