Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Text to IntValue? [SOLVED]

Asked by 8 years ago

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

Log in to vote
1
Answered by
Link150 1355 Badge of Merit Moderation Voter
8 years ago

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.

0
It worked, never knew of that function. Thanks! PreciseLogic 271 — 8y
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. Link150 1355 — 8y
Ad

Answer this question