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:
What I don’t get is GroupID is definitely apart of the part.
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.
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.