Well, I’m trying to send a FireServer with the data of a TextBox converted to ToNumber, but it gives me the error of the title and I don’t know what is the reason why it gives it
FrameSizeSlots:WaitForChild("TextBox"):GetPropertyChangedSignal("Text"):Connect(function()
FrameSizeSlots:WaitForChild("TextBox").Text = FrameSizeSlots:WaitForChild("TextBox").Text:gsub('%D+', '')
end)
FrameSizeSlots:WaitForChild("TextBox").FocusLost:Connect(function(enterPressed, inputThatCausedFocusLost)
if enterPressed then
local Number = tonumber(FrameSizeSlots:WaitForChild("TextBox").Text)
ChangeDataFPSAndPing:FireServer("SlotsInventory", Number)
FrameSizeSlots:WaitForChild("TextBox").PlaceholderText = "{0, "..Number.."},{0, "..Number.."}"
FrameSizeSlots:WaitForChild("TextBox").Text = "{".. Number.."}"
end
FrameSizeSlots:WaitForChild("TextBox").Text = ""
end)
FrameSizeSlots:WaitForChild("TextBox").Focused:Connect(function()
FrameSizeSlots:WaitForChild("TextBox").PlaceholderText = ""
FrameSizeSlots:WaitForChild("TextBox").Text = ""
end)
local TextBox = FrameSizeSlots:WaitForChild("TextBox")
add this to the begenning. Don’t do :WaitForChild every time when you can use a simple variable. Also is the text a number? If not then that will happen
It might be including the Enter key when FocusLost is fired - you probably need to sanitize the string. Iirc, you can sanitize it by doing str:gsub("%c", "").