|
| 29 May 2012 05:59 PM |
| In a script, how would I check if someone has a certain badge? I know others have done it, but I don't want to have to edit a free model. |
|
|
| Report Abuse |
|
|
magicdsi
|
  |
| Joined: 14 Feb 2010 |
| Total Posts: 276 |
|
|
| 29 May 2012 06:00 PM |
| PlayerHasBadge, search it in wiki im to lazy to get you a link |
|
|
| Report Abuse |
|
|
| |
|
|
| 30 May 2012 02:56 PM |
Ok, I have another question.
If I put
PlayerHasBadge BadgeID ~= [BADGEID]
And there was an ID inplace of [BADGEID], would it check if you have anything BUT this item?
|
|
|
| Report Abuse |
|
|
velibor
|
  |
| Joined: 24 Nov 2009 |
| Total Posts: 1003 |
|
|
| 30 May 2012 03:25 PM |
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)
Other said. This script will test or a Player has the Badge. If he has it will return a True value.
Just like :findFirstChild() that will also return a boolean.
Velibor
|
|
|
| Report Abuse |
|
|
|
| 30 May 2012 09:58 PM |
Not what I asked, and I already saw that on the Wiki.
Thanks anyway. :\ |
|
|
| Report Abuse |
|
|
|
| 30 May 2012 10:20 PM |
You can use the UserHasBadge method. It accepts two arguments, userId and assetId. Both must be integers.
The first is the id of the asset, the second is the id of the user.
If the user with the id userId owns the asset with the id assetId, the method will return true. Otherwise, it will return false. |
|
|
| Report Abuse |
|
|
| |
|