Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Text to IntValue? [SOLVED]

Creating something that requires the host to put a number value in a TextBox and then once ready, launch the action which changes the DeathLimit depending on what the host put into the TextBox.

My question is, can the Text inside the TextBox replace the value of an IntValue even if the Text is a number?

1 answer

✓ Accepted answer

You can transform a string into a number using the tonumber function.

myIntValue.Value = tonumber(textNumber)

Note that tonumber() will return nil if it couldn't successfully transform your string into a number.

2 comments

0

It worked, never knew of that function. Thanks!

0

Here, see this link for a list of all Lua functions: http://www.lua.org/manual/5.1/#index. Only the names under the "Lua Functions" category are of interest to you, the others are for C/C++ programs interfacing with Lua. Note that not all functions are be available in Roblox, and that some might have custom implementations.

This discussion is preserved as it was. New answers, comments, and votes are closed.