Get Equipped Gear Accessory

Is there a way to get the equipped gear accessory from a player? For example, if you equip a gear item on the avatar page, I want to see what gear item that is. I’ve tried HumanoidDescription, but it doesn’t appear to give any information regarding gear. I also don’t want to enable gear, I just want to see what gear the player has equipped (and I’d prefer not to use HttpService or any proxies).

1 Like

Yes, there is a way to get the equipped gear accessory from a player in Roblox. You can use the Player’s Character and check the children of the character to see if any of them are an equipped gear.

Here’s an example of how you can do it:

local function getEquippedGear(player)
local character = player.Character
if not character then
return nil
end
for _, child in ipairs(character:GetChildren()) do
if child:IsA("Tool") and child.Handle and child.Handle.AccessoryBasis then
return child
end
end
return nil
end

-- Example usage
local player = game.Players.LocalPlayer
local equippedGear = getEquippedGear(player)
if equippedGear then
print("Equipped gear: " .. equippedGear.Name)
else
print("No equipped gear found.")
end

In this script, we define a function called getEquippedGear that takes a player as an argument. The function first checks if the player’s character exists, and returns nil if it does not. Then, it loops through each child of the character, and checks if it is a Tool and has a Handle with an AccessoryBasis. If it does, then it is considered an equipped gear and is returned. If no equipped gear is found, nil is returned.

To use this function, you can pass in a player object and it will return the equipped gear tool object if there is one, or nil if there isn’t one.

1 Like

Thank you for the response, though I’m not talking about tools in-game. I’m referring to equipping a gear accessory on the website. I don’t want to enable gear into the game, I just want to get the ID of the equipped gear item on the website for their current avatar.

I see, my apologies for misunderstanding your question. In that case, there isn’t a built-in way to access the equipped gear from the website. However, you can try using the Roblox API to get the player’s current avatar and then parse the avatar data to get the IDs of any equipped gear items.

Here’s an example of how you could do that:

local Players = game:GetService("Players")
local Avatar = require(game:GetService("ReplicatedStorage"):WaitForChild("Avatar"))

local function getEquippedGear(player)
local characterAppearance = Avatar:GetPlayerAvatar(player)
if characterAppearance and characterAppearance.assets then
for _, asset in ipairs(characterAppearance.assets) do
if asset.assetType == "Accessory" and asset.equipped then
return asset.id
end
end
end
return nil
end
-- Example usage
local player = Players.LocalPlayer
local equippedGearId = getEquippedGear(player)
if equippedGearId then
print("Equipped gear ID: " .. equippedGearId)
else
print("No equipped gear found.")
end

In this script, we use the Avatar module from the Roblox API to get the player’s current avatar data. We then loop through the assets in the avatar data and check if any of them are accessories that are currently equipped. If we find an equipped accessory, we return its ID.

Note that this method requires the player to have their character and accessories loaded on the website, which may not always be the case. Additionally, this method may break if Roblox changes their avatar data format in the future.

What is this that you’re referring to?

Whoops, I messed up a little bit, delete that part. I was initially going to use it but I forgo to remove it.

1 Like

Absolutely nothing. ChatGPT isn’t giving them very much to give to you. They’re using ChatGPT on your behalf.


I’m not sure if it is possible to get gear a user has equipped directly from the roblox website, but for things like hats, body colors, shirts, pants, etc. (anything you could find in a player’s character), using GetCharacterAppearanceInfoAsync is useful. However, as already stated, I’m unsure if it is possible to get gear.

There is probably a way, but I am about 95% self-taught in Luau, and I’ve never actually needed to for any of my projects. There might be a way, but to my knowledge, there is not. You could try a bit more research, or wait to see if anyone else responds.

3 Likes

It looks like GetCharacterAppearanceInfoAsync does indeed return everything including gear under the assets array. Thanks for the help :+1:

1 Like

No problem! Glad to have helped.

This is a bad lie. The entire script that you copy + pasted from ChatGPT is built around that line of code which doesn’t actually coincide with a real Roblox API.

characterAppearance can’t be a real variable because it derives from a fake API.

This will always fail at the first check obviously. Aside from that though, there can be no “characterAppearance.assets” because, as stated, characterAppearances can’t be declared from this nonexistent thing.

Come on man.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.