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
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