Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 7 years ago

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

Log in to vote
0
Answered by 7 years ago

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--
0
but I want to put it in a table that separates each accessory ;-; Unbunn_makes 48 — 7y
0
It does separate each accessory. Mineloxer 187 — 7y
Ad

Answer this question