Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

empty test syntax?

what is the syntax to test if a field is empty?

1 answer

If you mean empty as in null, then you're looking for nil.

local variable = nil
if variable == nil then --// Can also be written as 'if not variable then', but that would make the if statement run if 'variable' was false (which is not nil).
	print("Variable doesn't exist!")
end

If you mean an empty string, then..

local variable = ''
if variable == '' then
	print('Empty string!')
end

Hope this helped.

This discussion is preserved as it was. New answers, comments, and votes are closed.