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

How do I change a string value to an int value?

Asked by 3 years ago
local check = script.Parent.Parent.AnswerBox.Text:toNumber()

AnswerBox is a TextBox where the user will input a number, that I'm going to compare in a separate function with another int, but I can't use the string value that that variable is giving me, and :toNumber() doesn't seem to work.

1 answer

Log in to vote
1
Answered by 3 years ago

That's not the right way of doing it, sir. Try this: local check = tonumber(script.Parent.Parent.AnswerBox.Text)

0
thanks a bunch! code seems to work now :) SamZeKat 28 — 3y
Ad

Answer this question