RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"award players a badge if they are in the same game as a player of a specific user id"
-- server script local badgeService = game:GetService("BadgeService") local badgeId = 123456789 -- Replace with your badge ID local targetUserId = 987654321 -- Replace with the specific user ID local function checkPlayers() local players = game:GetService("Players"):GetPlayers() local targetPlayerFound = false for _, player in ipairs(players) do if player.UserId == targetUserId then targetPlayerFound = true break end end if targetPlayerFound then for _, player in ipairs(players) do if player.UserId ~= targetUserId then badgeService:AwardBadge(player.UserId, badgeId) end end end end game:GetService("Players").PlayerAdded:Connect(checkPlayers) game:GetService("Players").PlayerRemoving:Connect(checkPlayers)