TextBox "Text" values and if statements

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I need a script that will check if the TextBox’s text is a number, if so, it will check if the value is bigger then another value. if it isnt, code gets run. Basically the player gets TP’d to a part in a folder inside of workspace. Basically, if you ever played a DCO or obby and you had that one feature where you could change stages back and fourth, im trying to make that.

  2. What is the issue? Include screenshots / videos if possible!
    I get something saying:
    image

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    This the code:

--[[
	// Name: Handler.lua
	// Author: official_ae#2606
	
]]
		
-- Variables

local checkpoints = workspace:WaitForChild("Folder")
local textBox = script.Parent.StageEnter
local textButton = script.Parent.StageTP
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local leaderstats = player:WaitForChild("leaderstats")
local stage = leaderstats:WaitForChild("Stage")
local rootPart = character:WaitForChild("HumanoidRootPart")

-- Functions

textButton.MouseButton1Click:Connect(function()
	local stageSelected = textBox
	print(player.Name.." clicked")
	print(textBox.Text)
	if stageSelected.Text > stage.Value then
		print("cant tp")
	else
		rootPart.CFrame = checkpoints:WaitForChild(stageSelected.Text).CFrame + 	Vector3.new(0,2,0)	 
	end

end)

I’ve read this article but I don’t understand what they are saying.

You can convert a string to a number with tonumber(myString). If the string cannot properly be converted to a number, your code would look something like:

local input = tonumber(stageSelected.Text)
if input and input > stage.Value then
    -- something
else
    -- something else
end

Works! Thanks mate
–char limit–