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 = [[number]] '''userId''', [[number]] '''badgeId'''
|arguments = [[Integer]] '''userId''', [[Integer]] '''badgeId'''
|returns = [[boolean]] ''has badge''
|returns = [[boolean]] ''has badge''
|description = Returns true if given user has the given badge.
|description = Returns true if given user has the given asset.
|object = [[BadgeService]]
|object = BadgeService  
}}</onlyinclude>
}}</onlyinclude>
{{clear floats}}
{{clear floats}}
{{Example|<pre>
{{Example|<pre>
game:GetService("BadgeService"):UserHasBadge(player.userId, 24806012)</pre>
 
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

UserHasBadge( Integer userId, Integer badgeId )
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.

See Also