How to add action to show text on second input the same text

How to add action:

I’m, trying to do little bonus code system,and i wanna do if player input second time same code,action will show text “Code Already used”

Make text variable

And when you input code however it is inputed
You add to your text variable “s”+CODE+“e”

For example you input 0549
So it would add to text variable s0549e

Then you add 4447
So you wound add to text variable
s4447e
And now your text variable looks like s0549es4447e

Another 1234 and so s1234e and so s0549es4447es1234e

If you don’t get it s tart e nd

So now you can check in condition IF your text variable contains “s”+CODE+“e”

You cannot add just code itself to text object
Cause if you add 1 and check if it contains 1 you will have problem if you will have there anything above 9
Cause 10 contains 1 31 contains 1 111 contains 1

And so go on
Unless you are 100% sure no code combo would be detected

For example imagine you will have 4 digits codes
Well hard to have them being parts of other codes

Well if you have code 1122 then another like 4511 and another 2290
Then you just put 45112290 so 45 1122 90
Yeah that is why you need that s+code+e
So bottom line if someone input valid code or you are just checking if code was already used
AFTER code is sent you check if text variable contains it the way i described above

If NOT you add it if YES you display your message

1 Like