Returning false

This if statement is inside a function and I want it to return false if the value is not equal to exp, cash or anything inside data_table.Towers. The issue is, I already used else for the for loop so I can’t fit a else return false in the code, how would I fix this?

	if value == "Exp" then
		return player.Currency.Exp.Value
	elseif value == "Cash" then
		return player.Currency.Cash.Value
	else
		for i,v in ipairs(data_table.Towers) do
			if value == v then
				return true
			end
		end
	end
1 Like

Add it below the for loop. If the for loop completes and none of the iterations return true then it’ll reach subsequent code of the for loop where you can place return false.

for i,v in ipairs(data_table.Towers) do
	if value == v then
		return true
	end
end
return false
1 Like

I see now, thanks for the help