Questions math roblox

So how would i do this.

local question = 1 + 1

But I dont want question to = 2 but I want it to literly equal to 1+1 is there a way?

Are you trying to store the literal expression?

You could use a string

local expression = "1+1"

And then parse (execute) it as needed, or what ever processing you want to do on it.

Not sure what you’re trying to do here though.

1 Like
local n1 = "1"
local n2 = "2"
local sign = "+"
local question = n1..sign..n2 -- would  be 1+2
-- either do this or you can use loadstring
local answer
if sign == "+" then
    answer = tonumber(n1)+tonumber(n2)
elseif sign == "-" then
    answer = tonumber(n1)-tonumber(n2)
end
answer = loadstring("return "..question)()

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.