I am trying to make a gui that allows players to do basic arithmetic in a text box. This is hte script I have so far- but its not working. It attempts to use loadstring to set a variable.
function click()
text = script.Parent.Parent.Text --sets the value 'text'
if string.sub(text,1,6) == "print(" then --if player uses print function
loadstring("x = " .. string.sub(text, 7, string.find(text, ")")- 1))
--set x to value of string between ( and ), so "print(2 + 4)" is 6.
script.Parent.Parent.Output.OPVal.Value = x -- set int value to x
end
end
script.Parent.MouseButton1Click:connect(click)
|