How do I check a users hats?

Hello! I’m developing anti-exploit and I want to kick somebody that has under 5 total hats in their roblox profile/accessories. Specifically hats. I’m curious to how or what API I can use to achieve this.


I mean you could just count them when they join, or use HumanoidDescription possibly.

Well some people have only 1-2 hats on their humanoid. I’m looking for a way to specifically use the API to check the users profile for hats, not on the humanoid

I don’t understand how having <5 hats means you are an exploiter?


well its not necessary an anti-exploit but an anti-alt system.

I think I understand now, and I don’t know if the web api’s respect a user’s privacy settings. And an account can be months/years old even and not have any hats. I think you are better off having better security in your game, since there is no way to differ between an alt and a genuine new user

Wouldn’t the best way to prevent mass alts from your game is to have it where their account has to be 10-30 days or older? This is since there are so many free accessories out on the Roblox platform that alts can quickly get in under a minute, and could easily get in like a normal player. The code would be simple. In a LocalScript, just type the following:

local minimumAge = 14
local accountAge = game.Players.LocalPlayer.AccountAge

if accountAge < minimumAge then
   game.Players.LocalPlayer:Kick("Your account age is too low!")

hmmm yeah we already have an age system, my development team were just brainstorming ideas to combat multiple exploiting systems

Ah, I see. Good luck with that.

Do not apply age restriction as it seems counterproductive to certain scenarios. Usually you want to secure the game design rather than filtering the general. Some alternate accounts are old enough to bypass that security already and it is already redundant.

In the other hand, @OP, hat count does not work against this exploit. Just assume that the server is seeing changes on the accessories that the player has.


Others already said it but yeah bad idea, I created my account in 2012 and still have no hats…

Well, there’s the Avatar API, which can fetch information about your assests, e.g. hats. Though I’m not sure if you get information about a single type of assest.

First get the player
Then get the player’s children
Then do if the children:IsA(“Accessory”) or if the children:IsA(“Hat”)
Then you will have identification of the player’s hats

I’ve done scripts with this sometimes and it all worked.

Taking by your idea i would do something like:

    local chr = player.Character
    local children = chr:GetChildren()
    if children:IsA("Accessory") -- This is just an example and not a full script

Just to not give you full scripts this is just an example for you to do it yourself

You would require this API:!/Inventory/get_v2_users_userId_inventory_assetTypeId

Problem is that you can’t hunt through private inventories. In this regard, checking how many hats a user owns is a pointless measure against alternate accounts and forcing users to lift their privacy measures just to play your game is a bad move.

There was another endpoint I saw which I thought I could use to check if players owned the verification hats. It was a very crude way to temporarily stop alts, but I later learned that it only works on game passes after noticing that the mountain of new bans were on accounts not verified and after double checking the API.

I’d think at the very least this one would bypass privacy since you’d actually need to know both the player and the asset id to actually check if they own the item, but alas apparently that’s not the case. So I can’t even check if players are verified which is unfortunate.!/Inventory/get_v1_users_userId_items_itemType_itemTargetId

Thanks! Just what I was looking for!