diff --git a/src/server/PlayerManager/Badges.lua b/src/server/PlayerManager/Badges.lua new file mode 100644 index 0000000..e94c630 --- /dev/null +++ b/src/server/PlayerManager/Badges.lua @@ -0,0 +1,18 @@ +local Players = game:GetService "Players" +local BadgeService = game:GetService "BadgeService" +local ReplicatedStorage = game:GetService "ReplicatedStorage" + +local badgeIDs = ReplicatedStorage.Config.Badges + +local function awardJoinBadge(player) + if not BadgeService:UserHasBadgeAsync(player.UserId, badgeIDs.Welcome.Value) then + BadgeService:AwardBadge(player.UserId, badgeIDs.Welcome.Value) + end +end + +Players.PlayerAdded:Connect(awardJoinBadge) +for _, player in Players:GetPlayers() do + task.spawn(awardJoinBadge, player) +end + +return 0 diff --git a/src/server/PlayerManager/init.lua b/src/server/PlayerManager/init.lua index 510584d..79766e3 100644 --- a/src/server/PlayerManager/init.lua +++ b/src/server/PlayerManager/init.lua @@ -90,6 +90,7 @@ require(script.GlobalLeaderboards) require(script.SoftShutdown) require(script.Settings) require(script.Tutorial) +require(script.Badges) --require(script.NoobSpawnFix) return 0