Running a maths problem from a string

Basically, I want to be able to simply duplicate my frame and change around a few values. One of these including the script to figure out the answer to the maths problem. (I am making a maths quiz game to help people study)

I don’t know how I could actually get the answer when I have the string. My current code is
local answer = loadstring(question.ScriptToFigureOut.Value)
However, that does not work. How would I go around doing this? (I had loadstring enabled!)

unrelated but why do you have loadstring enabled? you shouldnt generally use it unless you have a good reason to

I only had it enabled as I thought using the said piece of code (using loadstring) may function.

Here is a great module called ‘String calculator’ I think this is exactly what you need:

3 Likes

You could skirt the problem entirely and outsource the problem to some 3rd party REST API like https://api.mathjs.org/

I like @polarisprog’s suggestion, though!

1 Like