Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I get this function to print correct?

Asked by 5 years ago
Edited 5 years ago

This isn't my full script but this is the problem i can't resolve, even when the number 121 is typed in the Textbox it won't print correct.

Textbox = script.Parent

Textbox.Changed:Connect(function()
    if Textbox.Text == 121 then
        print('correct: '..Textbox.Text)
    else
        print('incorrect: '..Textbox.Text)
    end
end)

1 answer

Log in to vote
3
Answered by 5 years ago

This is probably because Textbox.Text is a string while 121 is a integer. You can try using tostring() on 121 or just make it a string from the very beginning.

0
thanks Handsomebud 113 — 5y
0
So glad I helped :D GGRBXLuaGG 417 — 5y
Ad

Answer this question