Group Badge Awarder

I’m trying to make a badge awarder that only awards you a badge if you’re in a group. Also, the script is also supposed to change the decal in the part to the group’s logo. So far it doesn’t award a badge/changes the decal. Here is the script I tried making:

local GroupService = game:GetService("GroupService")

local groupid = script.Parent.Groupid.Value
local badgeid = script.Parent.Badgeid.Value
local decal = script.Parent.Decal





local function getEmblemAsync(groupid)
    
    local info = GroupService:GetGroupInfoAsync(groupid)
        return info.EmblemUrl
    
    
end



decal.Texture = getEmblemAsync(groupid)


script.Parent.Touched:Connect(function(hit)
    local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
        if plr:IsInGroup(groupid) then
        game:GetService("BadgeService"):AwardBadge(plr.UserId, badgeid)
end
end)

Here is what is the output:
Screen Shot 2020-08-20 at 4.06.58 PM
What I don’t get is GroupID is definitely apart of the part.
Screen Shot 2020-08-20 at 4.07.24 PM

If you see anything wrong, please let me know.

1 Like

Are you receiving any errors in the output window?

Yes.
Screen Shot 2020-08-20 at 4.06.58 PM
What I don’t get is it’s definitely apart of the part.
Screen Shot 2020-08-20 at 4.07.24 PM

Okay, your first error is in the script you did Groupid and the value’s name is GroupID. It is the same scenario with Badgeid. The second error seems to be you did not properly set the value of BadgeID. Also, I would recommend putting a debounce and checking if a player owns the badge prior to awarding it.

1 Like

Screen Shot 2020-08-20 at 4.14.45 PM
I still get this error for some reason.

What’s the value set in the BadgeID value?

The value in it is “2124577381”.

Can you send an image of the properties window with the BadgeID value selected?

Screen Shot 2020-08-20 at 4.19.10 PM
The badge awarder works fine now, I’m just wondering why I am getting that error. Thanks for the help.

That’s odd, well glad you got it fixed.

Although the situation has been resolved, I suggest looking up any other Script Support topics that are related to this situation. There has been hundreds of users struggling with this script, and you could easily use find the solution by using the ‘Search’ bar in the right-hand corner of your screen.

1 Like