What's wrong with this function?

I’ve been working on something lately, and to make it a little bit more easier to use, I started adding module functions.

This function doesn’t work, why?

function BasicFuncs.FetchallParts2(standmodel)
	local Tables = {}
	for i=1, #standmodel do
			print("hi")
			if standmodel[i]:GetAttribute("Visible") then
				print("wow")
				if standmodel[i]:GetAttribute("Visible") == "true" then
					print("wow2")
					table.insert(Tables,standmodel[i])
			end
		end
		wait(0.1)
		return Tables
	end
end

Perhaps the return should be outside of the loop.

1 Like

I did that after posting, I didnt see much of a change

You haven’t specified exactly what isn’t working about your function. Is it producing an error or it isn’t working as were expected it to?

It isn’t returning what I wanted it to, however after changing the function a little, I got it to function now. Thanks for helping

1 Like