UserHasBadge (Method)
From Legacy Roblox Wiki
(Redirected from UserHasBadge)
UserHasBadge( Integer userId, Integer assetId ) | |
Returns | boolean has asset |
Description: | Returns true if given user has the given asset. |
Member of: | BadgeService |
Example
BadgeId = # game.Players.PlayerAdded:connect(function(p) if game:GetService("BadgeService"):UserHasBadge(p.userId, BadgeId) then print("The user has this badge") else print("The user does not have this badge") end end) -- This can be used for any item. So the BadgeId could be a model id instead. -- You could use a "Play my place" T-shirt and check to make sure they have that shirt, if they don't then it can remove them.
Limitations
- Items can not be checked from Build or Edit mode. This can only be used on a ROBLOX Game server.
Tip
- You can use UserHasBadge for checking any asset on ROBLOX. Meaning hats, shirts, pants, and etc., can be checked with it.