Yes lol. This was my script, tell me if this will work:
local badgeService = game:GetService("BadgeService")
local MVPBadgeId = 1234567890
local BadgeNeeded1id = 1234567890
local BadgeNeeded2id = 1234567890
local BadgeNeeded3id = 1234567890
local BadgeNeeded4id = 1234567890
local function onPlayerAdded(player)
-- Check if the player has the badge
local success1, hasBadgeS = pcall(badgeService.UserHasBadgeAsync, badgeService, player.UserId, BadgeNeeded1id)
local success2, hasBadgeB = pcall(badgeService.UserHasBadgeAsync, badgeService, player.UserId, BadgeNeeded2id)
local success3, hasBadgeA = pcall(badgeService.UserHasBadgeAsync, badgeService, player.UserId, BadgeNeeded3id)
local success4, hasBadgeT = pcall(badgeService.UserHasBadgeAsync, badgeService, player.UserId, BadgeNeeded4id)
if hasBadgeS, hasBadgeB, hasBadgeA, hasBadgeT then
badgeService:AwardBadge(player.UserId, MVPBadgeId)
end)
local badges = {"123", "456"}
local StartBadgeID = "789"
local BS = game:GetService("BadgeService")
if BS:UserHaSBadgeAsync(StartBadgeID, game.Players.LocalPlayer.UserId) then
print("Has the start badge!")
for i, v in ipairs(badges) do
if not BS:UserHasBadgeAsync(v, game.Players.LocalPlayer.UserId) then
BS:AwardBadge(v, game.Players.LocalPlayer.UserId)
end
end
end
--//Services
local Players = game:GetService("Players")
local BadgeService = game:GetService("BadgeService")
--//Controls
local MVPBadgeID = 000000000
--//Tables
local BadgeIDsNeeded = {
000000000,
000000000,
000000000,
000000000
}
--//Functions
Players.PlayerAdded:Connect(function(player)
local hasFirstBadge = false
local hasSecondBadge = false
local hasThirdBadge = false
local hasFourthBadge = false
for i, badgeId in ipairs(BadgeIDsNeeded) do
local success, hasBadge = pcall(function()
return BadgeService:UserHasBadgeAsync(player.UserId, badgeId)
end)
if not success then
warn("Error while checking if player has badge!")
return
end
if hasBadge then
if i == 1 then
hasFirstBadge = true
elseif i == 2 then
hasSecondBadge = true
elseif i == 3 then
hasThirdBadge = true
elseif i == 4 then
hasFourthBadge = true
end
end
end
if hasFirstBadge and hasSecondBadge and hasThirdBadge and hasFourthBadge then
local success, result = pcall(function()
return BadgeService:AwardBadge(player.UserId, MVPBadgeID)
end)
if not success then
warn("Error while awarding badge:", result)
elseif not result then
warn("Failed to award badge.")
end
end
end)
No, all of the items in the badges table are awarded if they have the StartBadge. Here’s what I think you mean now;
local badges = {"123", "456", --[[etc]] }
local CompleteBadge = "1234"
local BS = game:GetService("BadgeService")
local Count = 0
local RequiredCount = 4
for i, v in ipairs(badges) do
if BS:UserHasBadgeAsync(game.Players.LocalPlayer.UserId, v) then
Count += 1
end
end
if Count == RequiredCount then
if not BS:UserHasBadgeAsync(game.Players.LocalPlayer.UserId, CompleteBadge) then
BS:AwardBadge(game.Players.LocalPlayer.UserId, CompleteBadge)
end
end