Like, if you have a badge, then he get a item from the catalog?
Thanks!
Follow me on ROBLOX Click Here
Like, if you have a badge, then he get a item from the catalog?
Thanks!
Follow me on ROBLOX Click Here
There is a special service provided for badges. There is a wiki page here.
So we need to use the service using the method :GetService() from the game. We then use a function to check every time a player joins to see if he has a badge. I literally copied the script from the wiki but hey, faster answer response for you and easier work for me. Plus, I already knew this.
local BadgeService = game:GetService("BadgeService")
local BadgeId = 123
game:GetService("Players").PlayerAdded:connect(function(player)
if BadgeService:UserHasBadge(player.UserId, BadgeId) then
item = game:GetService("ReplicatedStorage").SpecialItem
item:Clone().Parent = player:WaitForChild("Backpack")
else
print("The user does not have this badge")
end
end)
Change "123" at local BadgeId = for the correct ID. Put your special item in ReplicatedStorage so that the script can pick it up. You can either change the name of the item to SpecialItem or change the name of SpecialItem inside the script.
If you don't care about the other result where the player wouldn't have the badge, just remove else and the print command.
EDIT: Sorry, I thought it was a gamepass, I corrected it to the badge instead. But for gamepasses and developer products, they require a different service called MarketplaceService.
He'd actually want to use UserHasBadge.
Oops. My mistake.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Wow, already -1, :,(
do not put requests for people to follow you in your questions, also supply code with your questions, and accept personacole's answer