Hi. So I wanted to make like a number only textbox. So I am trying to remove all the alphabets written on the textbox. However, the solution I have come up with only works for letter a which is the first letter in the module script I wrote. Is there a reason why this is happening? There are no errors btw.
Your help would be kindly appreciated.
local Player = game:GetService("Players").LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local Screen = PlayerGui:WaitForChild("Screen")
local Box = Screen:WaitForChild("Box")
local Get_Text = Box.Text
local Debounce = false
local text = ""
local Alphabets = require(script:FindFirstChild("Alphabets"))
local function RemoveString (Character, String)
local StringTab = {}
for a = 1, string.len(String) do
local CurrentString = string.sub(String, a, a)
table.insert(StringTab, a, CurrentString)
end
for __, value in pairs (StringTab) do
if value == Character then
table.remove(StringTab, __)
end
end
local FinalString = table.concat(StringTab)
return FinalString
end
local function CheckStuff ()
if Debounce then return end
Debounce = true
if Get_Text ~= Box.Text then
Get_Text = Box.Text
end
local Main_Text = Get_Text:gsub("[%s]", "")
if Main_Text == "" then
print("NO CURRENT TEXT!")
end
local FinalString = RemoveString(unpack(Alphabets), Main_Text)
print(FinalString)
Box.Text = FinalString
Debounce = false
end
Box.Changed:Connect(CheckStuff)

1 comment
Thanks but I already had solved it with another way. Still gonna accept ur ans lol