Right now I am attempting to get every new player's acessory name and put it into a table. I run into an issue when I run this code to print the namer of every acessory on a player
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
print(player.Name .. " joined the game!")
print(player.Name .. " joined the game!")
local char = player.Character or player.CharacterAdded:Wait()
print(char)
print(player)
print(player.Character)
print("Test Test TEst")
local function Getacessory(char)
local descendants = char:GetDescendants()
for index, descendant in pairs(descendants) do
if descendant:IsA("Accessory") then
print(descendant.Name)
end
end
end
Getacessory()
end)
If anyone has solutions for a more efficient technique or a solution pls let me know!

1 comment
the parameter "char" in your function isn't the character because when you call the function on line 20, the character isn't defined in those parenthesis. Try changing line 20 to Getacessory(char)