AwardBadge (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Camoy
fixed
>SoulStealer9875
No edit summary
 
(24 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<onlyinclude>{{Method|name = AwardBadge
<onlyinclude>{{Method
|arguments = [[Number]] ''UserId'', [[Number]] ''BadgeId''
|name                 = AwardBadge
|returns = [[nil]]
|arguments           = [[Integer]] ''userId'', [[Integer]] ''badgeId''
|description = Gives player a [[Badges|badge]].
|description         = Gives player with ''userId'' a [[badge]] with ''badgeId''.
|object = [[BadgeService]]
|object               = BadgeService
}}</onlyinclude>
}}</onlyinclude>
{{clear floats}}
{{clear floats}}
{{Example|
 
<pre>game:GetService("BadgeService"):AwardBadge(player.userId, 24806012)
{{Example|<pre>
player = game.Players.LocalPlayer
game:GetService("BadgeService"):AwardBadge(player.userId, 24806012)
 
-- Awards your LocalPlayer (must be in a LocalScript) the badge with the ID of 24806012.
 
</pre>}}
</pre>}}
== Limitations ==
== Limitations ==
* Badges can only be awarded from Roblox Game Servers. This means it must be a server-side script running online.
* Badges can only be awarded to players in Server's. This means it can not be awarded in Edit or Build mode.
* The owner of the place must own the badge and it must be for the place that is awarding it.
* The owner of the place must own the badge. If they delete it from their badges it can no longer be awarded.
* The owner of the place must have a current [[Builder's Club]] subscription.
* The owner of the place must be subscribed to [[Builder's Club]].


== See Also ==
== See Also ==
*[[UserHasBadge (Function)|UserHasBadge]]
*[[UserHasBadge]]
*[[Badges]]
*[[Badges]]
[[Category:Methods]]
[[Category:Methods]]

Latest revision as of 12:05, 10 July 2011

AwardBadge( Integer userId, Integer badgeId )
Returns nil
Description: Gives player with userId a badge with badgeId.
Member of: BadgeService


Example
player = game.Players.LocalPlayer
game:GetService("BadgeService"):AwardBadge(player.userId, 24806012)

 -- Awards your LocalPlayer (must be in a LocalScript) the badge with the ID of 24806012.



Limitations

  • Badges can only be awarded to players in Server's. This means it can not be awarded in Edit or Build mode.
  • The owner of the place must own the badge. If they delete it from their badges it can no longer be awarded.
  • The owner of the place must be subscribed to Builder's Club.

See Also