For the game I need you to receive 2 badges, then enter the game and you will be given 1 badge
Help me pls!
check if the player has the badge that you want to give, if the player does not have it, check if has the other two, then give it the badge, if not, dont
You can do this with UserHasBadgeAsync, and award badge as the last one.
local BadgeService = game:GetService("BadgeService")
local badges = { -- replace with the badges that are needed
12345,
12345
}
local MainBadge = 1234567890 -- badge that will be given if player has the others
game.Players.PlayerAdded:Connect(function(p)
local passes = 0
for _, v in next, badges do
if BadgeService:UserHasBadgeAsync(p.UserId, v) then
passes += 1
end
end
if passes >= #badges then
BadgeService:AwardBadge(p.UserId, MainBadge)
end
end)
(haven’t tested it yet)
That would work if it was for every badge in the game.
If its only if a player has two specific badges then you should just nest two if statements with each checking one of the specific badges
I’m aware of that, same functionality as the other,
Only made it a table in case the OP in the future wants to add more badges, instead of creating a messy if structure.
Readable to customize it too
its works, big thanks bro! You very help me! Big thanks!
If this works for you then mark his reply to you as the solution.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.