Hello, Devs!

I tried to make TextBox that will change IntValue value and print out text in int by using ToNumber. It printed out int, but didn't changed IntValue value.

CODE:

while wait() do
	script.Parent.FocusLost:Connect(function()
		local focuslosttext = script.Parent.Text
		local text = tonumber(focuslosttext)
		print(text)
		script.Value.Value = text
	end)
end

ERRORS:

No errors

DETAILS:

ScreenGui located in startergui, frame located in ScreenGui, textbox located in frame, LocalScript located in textbox, IntValue located in LocalScript.

4 comments

0

Remove the while loop. Roblox detects events whenever the event triggers, so a while loop isn't necessary, and actually wastes resources.

0

What is FocusLost?

0

Where you move your mouse out of the GuiObject. In this case, textbox.

0

Removing the while loop didn't worked.