How would I go about making MULTIPLE GUI appear if a user owns 1 badge?

I have a script already set up for this that works with one GUI unlocking per badge, however I don’t know how to make 1 badge work for multiple GUI in the list.


local ScrollingFrame = script.Parent

	local BadgeService = game:GetService("BadgeService")
	local Badges = {
	2546775546526272, -- Painter Crafty
	1044895532817688,  -- Allister Gator
	1073217591554681,  -- Rudolph Badge
	1224871755975777, --  Christmas Nightmares
		2127245024, -- 5
		2127245129, --Bonus 1
		2127245139, -- Bonus 2
		2127245185 -- Bonus 3
	} -- Place IDs here!
for Index,BadgeID in ipairs(Badges) do

local success, hasBadge = pcall(BadgeService.UserHasBadgeAsync, BadgeService, player.UserId, BadgeID)

	if hasBadge then
		if ScrollingFrame:FindFirstChild(tostring(BadgeID)) then
			ScrollingFrame:FindFirstChild(tostring(BadgeID)).Visible = true
		end
	end
end

I have attempted to look through the forum, and maybe I missed it but I’ve only been able to find one that work for one badge, or ones with errors that make the badges disappear after morphing into the character.

These badges are morph badges that make a morph UI visible if that badge is owned. The script basically looks at the name of the button to see if it matches the badge in the string. Having multiple with the same name results in only one of the UI showing up.

1 Like
for i, e in ScrollingFrame:children() do
   if e.Name == tostring(BadgeID) then
      e.Visible = true;
   end;   
end;
2 Likes

Thank you so much! Worked like a charm ^^

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.