Hello!
I’m working on making a playlist manager and I’ve run into an issue where if you enter non-alphanumeric/non-whitespace characters, they appear to be worth more than 1 character (and just for reference, I’m looking to give players the option to write up to 20 characters in a textbox). And at the end, it has a box with an X in it.
Video:
Script:
input:GetPropertyChangedSignal('Text'):Connect(function()
local newText = input.Text:sub(1,20) -- this limits it to 20 characters for input, so a player *should* be able to write up to 20 characters, regardless of whether they're alphanumeric or not
input.Text = newText
if lastText ~= newText then
local currentTick = tick()
lastTick = currentTick
previewLabel.Text = formatString:format(input.Text:gsub('[^%s]', '_'))
local filtered = formatString:format(filterFunction:InvokeServer(input.Text))
if lastTick == currentTick then
previewLabel.Text = filtered
end
end
lastText = newText
end)