Hi, I'm making a script where the player gets 2 random values at the top of the screen, and has to do addition to find the correct answer. I've set up the value part but I've noticed that the script doesnt recognize the correct answers. I expected it to work by doing something like if T.Text == sum then
but that doesn't seem to be working. How do I fix this?
local T = script.Parent local Question1 = (math.random(1,10)) local Q1 = script.Parent.Parent.QuestionBox1 local p1 = (Question1) Q1.Text = Question1 local Question2 = (math.random(1,10)) local Q2 = script.Parent.Parent.QuestionBox2 local p2 = (Question2) Q2.Text = Question2 T.FocusLost:Connect(function(enterPressed) if enterPressed then local sum = (p1 + p2) print(T.Text) print(sum) if T.Text == sum then print("Correct") end end end)
I converted the string of T.Text
using the tostring()
command.