Hello, i’ve been doing math equations script and I ran into a problem that if statement doesn’t run at all. I’ve debugged it and found out that the script works before the if statement and then stops.
local AnswerTextbox = script.Parent
local Answer = AnswerTextbox.Parent:GetAttribute("Answer")
local RS = game:GetService("ReplicatedStorage")
local Events = RS.Events
AnswerTextbox:GetPropertyChangedSignal("Text"):Connect(function()
AnswerTextbox.Text = AnswerTextbox.Text:gsub('%D+', '');
end)
AnswerTextbox.FocusLost:Connect(function(enterPressed)
if enterPressed then
print("enter pressed") -- prints
if AnswerTextbox.Text == Answer then
print("someone typed "..AnswerTextbox.Text.. " as their answer!") -- doesn't print
print("the answer is: "..Answer.."!") -- doesn't print
end
end
end)
Any help will be appreciated!