UserHasBadge (Method): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Camoy fixed |
>ArceusInator No edit summary |
||
Line 1: | Line 1: | ||
<onlyinclude>{{Method|name = UserHasBadge | <onlyinclude>{{Method|name = UserHasBadge | ||
|arguments = [[ | |arguments = [[Integer]] '''userId''', [[Integer]] '''badgeId''' | ||
|returns = [[boolean]] ''has badge'' | |returns = [[boolean]] ''has badge'' | ||
|description = Returns true if given user has the given | |description = Returns true if given user has the given asset. | ||
|object = | |object = BadgeService | ||
}}</onlyinclude> | }}</onlyinclude> | ||
{{clear floats}} | {{clear floats}} | ||
{{Example|<pre> | {{Example|<pre> | ||
game:GetService("BadgeService"):UserHasBadge(player.userId, | |||
function CheckPlayerHasAsset( user, assetId ) | |||
return game:GetService( "BadgeService" ):UserHasBadge( player.userId, assetId ) | |||
end | |||
-- This, unlike AwardBadge(), can be used to check for any asset, not just badges.</pre> | |||
}} | }} | ||
Revision as of 01:08, 26 December 2010
![]() | |
Returns | boolean has badge |
Description: | Returns true if given user has the given asset. |
Member of: | BadgeService |
Example
function CheckPlayerHasAsset( user, assetId ) return game:GetService( "BadgeService" ):UserHasBadge( player.userId, assetId ) end -- This, unlike AwardBadge(), can be used to check for any asset, not just badges.
Limitations
- Badges can only be checked from Roblox Game Servers. This means it must be a server-side script running online.