Annoying Error Message - simple but im kinda dumb and lazy lol

So, i’ve come across this a lot.

I usually use repeat wait(), but I need it to check if there are actually items in the folder.

current code

if trade.Player1Offerings:FindFirstChild("Item")~=nil then
		trade.P1Offer = getInvTable(tbl.Player1Offerings)
	else
		trade.P1Offer = "none"
	end

Tried :GetChildren(), :FindFirstChild(), and ~= nil

Idk any decent solutions, if you have any, reply with it
thankss

just add trade:WaitForChild(“Player1Offerings”)

1 Like

Try this

if trade.Player1Offerings:FindFirstChild("Item") then
		if trade.Player1Offerings:FindFirstChild("Item") ~= nil then
trade.P1Offer = getInvTable(tbl.Player1Offerings)
	else
		trade.P1Offer = "none"
	end
end

So it basically checks if it exists and then it checks if it is nil

1 Like

That could make a yield if it doesn’t exist

hold up same thing happened

This is because you didn’t check if Player1Offerings exist or not, you should check if it exists first, because the scripts can sometimes run before it creates the offerings ui

if trade:FindFirstChild("Player1Offerings") then
    if trade.Player1Offerings:FindFirstChild("Item") then -- This is the same as checking if it is not = to nil
        trade.P1Offer = getInvTable(tbl.Player1Offerings)
    else
        trade.P1Offer = "none"
    end
end