Give Badge when player likes the Game and Joins the Roblox Group. How?

  1. What do you want to achieve? I want to have a special badge for players who click a like for the Game and Join my Roblox Group.

  2. What is the issue? I know how to give badges, no problem. However, I do not know how to check if a player clicked like for the Game. I also do not know how to check if the player is a member of my Roblox group.

  3. What solutions have you tried so far? I’ve looked for solutions on the dev forum and google. Nothing. I may be writing the question wrong, so nothing relevant appears in search for me. I can do the badge, no problem. I just need to know how to approach getting the player information. I need to know how to see, on player join (did the player like the game?) and (did the player join the Roblox Group?). If so, I would award the badge. But how do I get this player information?

After that, you should include more details if you have any. I did not think doing this was even possible, but then I saw another dev doing it. How are they doing it? The dev is too popular to respond to me. Here is a link to their badge description. [🎃] Pet Story 🐶 - Roblox See the last badge, called Teddie’s Gang.

Thank you for your help!

3 Likes

Don’t think there is a way to see if they liked your game but for joining the group as well as awarding a badge here you go…


local player = game:GetService("Players").LocalPlayer

local group = 10131433 -- group id

if player:IsInGroup(group) then

-- you would award the badge here i just did a print statement for testing

print("player is in group")

end
3 Likes

You can’t find out if someone likes your game.

Here’s a script that gives the player a badge if they join your Roblox group though:
(make sure this is a server script inside ServerScriptService)

--//Services
local Players = game:GetService("Players")
local BadgeService = game:GetService("BadgeService")

--//Variables
local BadgeId = 0000000 --//Insert your badge id
local GroupId = 0000000 --//Insert your group id

--//Functions
Players.PlayerAdded:Connect(function(player)
	if player:IsInGroup(GroupId) then
		local awarded, errorMessage = pcall(function()
			BadgeService:AwardBadge(player.UserId, BadgeId)
		end)
		
		if not awarded then
			warn("Error while awarding badge:", errorMessage)
		end
	end
end)
5 Likes

You can not give badges client-side so your going to have to do it server-side like what my script does.

Also, pet story doesn’t actually check if you liked the game when it gives you the badge. I just tried and joined the group without liking the game but it still gave me the badge.

I know I was just giving him an example and linking documentation for him to figure it out himself, anyways is it good practice to wrap all your functions in a pcall? I don’t really see a point in this case because I don’t think the BadgeService would ever error.

BadgeService does error. You shouldn’t wrap all your functions in a pcall but Roblox recommends that you wrap BadgeService:AwardBadge() in a pcall.

1 Like

Hi Katrist and ScroomDrainer,
Thank you both for all this great information and for how to check for group membership.
@Katrist. Thank you for going the extra mile and confirming that Pet Story doesn’t actually check if you liked the game for the badge. I would have been trying FOREVER to figure out how to do that. Also, thank you for helping me understand that badgeservice should be in a pcall, I had been making the mistake of not doing that too.

1 Like