How i can fix that problem?

I have a script that outputs the player’s level from Int Value - if the player’s rank is 0, then he is a Starter if the player’s level is 41, then he is a tester but for some reason, only the starter is output even when intvalue 41
script:

local Player = game:GetService("Players").LocalPlayer
local Level = Player.Data.Levels

Level.Changed:Connect(function()
	if Level.Value >= 0 then
		script.Parent.Text = "Starter"
	elseif Level.Value >= 41 then
		script.Parent.Text = "Tester"
	elseif Level.Value >= 39 then
    	script.Parent.Text = "Beta Tester"
		end
end)

That’s because 41 is also bigger than 0. That means that always the first branch of the id is taken.

Try to reorder such that Tester is first, Beta Tester is second and Starter is last

local Player = game:GetService("Players").LocalPlayer
local Level = Player.Data.Levels

Level.Changed:Connect(function()
	if Level.Value >= 41 then
		script.Parent.Text = "Tester"
	elseif Level.Value >= 39 then
		script.Parent.Text = "Beta Tester"
	elseif Level.Value >= 0 then
    	script.Parent.Text = "Starter"
		end
end)

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