Detect what number player is typing into text box

im trying to make a rendering distance control where the player types a number 1-10 into the textbox and whatever number they put in will change the rendering.qualitylevel by 2 numbers but i dont know how to detect what number a player has typed into the text box. any help is appreciated

local TextBox = script.Parent -- Example
TextBox.FocusLost:Connect(function(Enter)
if Enter == true then -- Checks if EnterKey Is Pressed.
local Number = tonumber(TextBox.Text)
if Number then -- checks if the textbox has only numbers if not it will not continue.
--- stuff here.
end
end)
2 Likes
local TextBox = -- destination

TextBox.FocusLost:Connect(function()
if TextBox.Text:match("%d+") then -- Checks for a number
  print(TextBox.Text) -- Should print the integer 
    end
end)

1 Like

how can i make it where an event only triggers when a certain number is typed i.e. rendering.qualitylevel goes to 2 when player types 1 into the box

you can check for the number by doing

if Number == 1 then
-- stuff here
end

but unfortunately i think you cant edit the roblox rendering qualitylevel

oh that sucks thanks for letting me know

2 Likes