I have a script that awards players badges for the first time they join, and the first time they join after becoming an employee. Here’s my script:
local previouslyJoined = false
local success, result = pcall(function()
previouslyJoined = BadgeService:UserHasBadgeAsync(player.UserId, youJoinedBadge)
end)
if not success then
print(result)
elseif not previouslyJoined then
local success, result = pcall(function()
BadgeService:AwardBadge(player.UserId, youJoinedBadge)
print("you joined awarded")
end)
if not success then
print(result)
end
elseif previouslyJoined then
print("previously joined")
end
if player:GetRankInGroup(11635716) >= 3 then
print("high enough rank")
local hasEmployee = false
local success, result = pcall(function()
hasEmployee = BadgeService:UserHasBadgeAsync(player.UserId, employeeBadge)
end)
if not success then
print(result)
elseif not employeeBadge then
local success, result = pcall(function()
BadgeService:AwardBadge(player.UserId, employeeBadge)
print("employee awarded")
end)
if not success then
print(result)
end
elseif hasEmployee then
print("has employee")
end
end
It will award the joining badge, but it won’t award the employee badge, even though it says I am high enough rank. Why is this happening?