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

How do you put all the player's accessories into a table?

I want to make it so each hat is in a table separated it so I can call it. But I don't know how :(

I want the table to look like this

local table = {hat1,hat2,hat3} do I use for i,v in pairs and then use insert for each hat? if so, then how would I do that?

1 answer

Luckily you won't even have to use a loop! The Humanoid object comes with a method to do it for you.

Use example:

--LocalScript
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character

local Accessories = Character:WaitForChild("Humanoid"):GetAccessories()

--Insert more code here BEEP BEEP--

2 comments

0

but I want to put it in a table that separates each accessory ;-;

0

It does separate each accessory.

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