Typechecking warning

What does this mean and how can I get rid of it? The function just checks a table content then returns a boolean.
image

Not all code paths return a boolean. Try adding return false to the end of your function.

1 Like

In addition to what @bluebxrrybot said, you can also modify the return type to boolean?, which makes returning a boolean optional

Adding it does nothing and the warning remains.

function Check(Table:{}):boolean?
	if type(Table) ~= "table" then
		return false
	end
	local Unpacking = table.unpack(Table)
	if typeof(Unpacking[1]) ~= "Instance" then warn("ARGUMENT 1 IS NOT AN INSTANCE.") return false end
	if type(Unpacking[2]) ~= "string" then warn("ARGUMENT 2 IS NOT AN STRING.") return false end
	if type(Unpacking[3]) ~= "string" or type(Unpacking[3]) ~= "boolean" then warn("ARGUMENT 3 IS NOT ACCEPTABLE..") return false end
end

Then, you should add return false at the end of your function as the first reply mentions

2 Likes

weird, because that should work right? No return is nil lol

Maybe try boolean | nil

Same error. Putting return true removed the warning.
image

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.