Odd problem with comparing strings

if DisplayName.Text ~= 'Enter Display Name...' or DisplayName.Text ~= '' or DisplayName.Text == 'Name too long' then
	print('Did not equal')	
	Display = DisplayName.Text
end
	
print(Display, DisplayName.Text)

Output returns
[Did not equal]

[Enter Display Name… Enter Display Name…]

No, if DisplayName.Text == ‘Enter Display Name…’ then it should have not printed (‘Did not equal’)

But when DisplayName.Text == ‘Enter Display Name…’ it still for some reason is printing it

In your if-statement:

DisplayName.Text ~= ''

If DisplayName.Text isn’t empty, then Did not equal will print.

Looks like you need to use the and feature.

This is my guess and what you are attempting to do:

if DisplayName.Text ~= 'Enter Display Name...' and DisplayName.Text ~= 'Name too long' and DisplayName.Text ~= '' then
	print('Did not equal')	
	Display = DisplayName.Text
end
6 Likes