Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to keep a text box's characters, to just 1, 2, 3, and 4? (Solved)

Asked by 4 years ago
Edited 4 years ago

So, in my game, this is for the lobby. When they make a lobby, they can make it 1 - 4 players. But text boxes can have letters, numbers, and lots of them. Is there a way to make it only be able to have 1 - 4, just once. So not 11 22 33, etc... I found some code, but it doesn't work.

local TextBox = script.Parent
TextBox:GetPropertyChangedSignal("Text"):Connect(function()
    if tonumber(TextBox.Text) then
        script.Parent.Number.Value = script.Parent.Text
    else
        TextBox.Text = "1" 
    end
end)

1 answer

Log in to vote
0
Answered by 4 years ago

I found a different way to do it! Thanks to Utter_Incompetence.

https://scriptinghelpers.org/questions/97190/is-there-a-way-to-see-when-a-text-boxes-text-is-changed

Ad

Answer this question