Attempt error to compare number <= string (No sense)

Hey guys the problem is that is getting error for string and number but the “String” its a number too


that number 1 is the print of numMatch that basically is the player mastery

    local number = Gui.Background.FrameTitle.Text
				local numMatch = number:match("%d+") -- to get number in the text. The text is Fuwa Mastery: 1 the 1 gonna upload when player get new level
				print(numMatch) -- player mastery printed 1 but i can put 600 and pass of mastery required number but still getting error
				if v.Name == "ck" then
					if numMatch >= 325 then -- 325 is the mastery required to use but i can put too v.MasteryRequired but its says the same problem and this is the line that get error
						print("Can use") -- to detect if the script work
						end						

					end
				end

please help me i gonna add more information if is nessecited

just use string.gsub

 local number = Gui.Background.FrameTitle.Text
				local numMatch = string.gsub(number , "%D", "") -- to get number in the text. The text is Fuwa Mastery: 1 the 1 gonna upload when player get new level
				print(numMatch) -- player mastery printed 1 but i can put 600 and pass of mastery required number but still getting error
				if v.Name == "ck" then
					if numMatch >= 325 then -- 325 is the mastery required to use but i can put too v.MasteryRequired but its says the same problem and this is the line that get error
						print("Can use") -- to detect if the script work
						end						

					end
				end
1 Like

hey its still not working what i do its says the same error

It’s possible that the ‘number’ could possibly be a string, I’m unfamiliar with :match() so apologies if my answer is incorrect.

if it’s only printing a number, then you can just do this instead

if tonumber(numMatch) >= 325 then
    print("Can use")
end

Maybe using the match from string library might work:

 local number = Gui.Background.FrameTitle.Text
				local numMatch = string.match(number , "%d+") -- to get number in the text. The text is Fuwa Mastery: 1 the 1 gonna upload when player get new level
				print(numMatch) -- player mastery printed 1 but i can put 600 and pass of mastery required number but still getting error
				if v.Name == "ck" then
					if numMatch >= 325 then -- 325 is the mastery required to use but i can put too v.MasteryRequired but its says the same problem and this is the line that get error
						print("Can use") -- to detect if the script work
						end						

					end
				end
1 Like

now is working thanks :smiley: lol
gs

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