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

why does my argument always come back nil?

local Chest = Replicated.Clothes.Chest:GetChildren()

for i, v in pairs(Chest)do
			print(player.Character:FindFirstChild(v))
		end

so what I'm doing is checking if a player has an accessory on listed in the Chest folder but even when I should get a true statement it always comes back Nil

1 answer

✓ Accepted answer

The :FindFirstChild() function will always return nil in your case, due to the fact that it only accepts a string Name as the input, and you are passing a value of type Instance. You can read more about it here.

In your case, you could do something like this:

local Chest = Replicated.Clothes.Chest:GetChildren()

for i, v in pairs(Chest) do
    if player.Character:FindFirstChild(v.Name) then
        print("player is wearing "..v.Name)
    else
        print("player is not wearing "..v.Name)
    end
end

1 comment

0

oh my how did I look passed that I even thought about that thank you so much!

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