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

How do i use a text from a textbox as a number value(when it's a number of course)?

So i have a textbox inside a gui that has a number 1 inside it by default, i need to be able to use whatever number is in that textbox as a number value that i can compare and add or subtract from other numbers inside various scripts. Any ideas how i could do that?

5 comments

0

Wait, are you going to use RemoteEvents, if so you could easily fire it to the client or server and use the parameter of your number.

0

I will be using a remote event to transfer a few values from the client to the server and edit 2 of them in the server

0

So how exactly am i supposed to work with those number parameters, if you don't feel like explaining i'd be satisfied with the dev wiki article link too

0

I'm not entirely sure if I know what you mean but could you just add an actual numbervalue object with the same value and have the scripts call upon that?

0

That value is being changed by the player in that text box, i need to be able to use that, but it cannot recognize that number inside the textbox as a number, it thinks of it as a string value

1 answer

✓ Accepted answer

You can get the number as tonumber(TextBox.Text) if it's really just a number. If someone is allowed to type in something that's not a valid number (like their name) tonumber() will give you nil.

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