So I want to make a badge that will be awarded to 2 or more people at the same time. Basically When you and your friend is in the same server, you both will receive the badge for being in the server together. But i have no idea how to make this kind of badge.
Could anyone please help me? I would be really thankful.
Any time a player joins, check if they are friends with any other players in the server (using the IsFriendsWith API), and if they are then award the badge to both players. You may also want to check every few minutes, in case they friend each other while in game.
e.g.
local BadgeService = game:GetService("BadgeService")
game.Players.PlayerAdded:Connect(function(player)
for _, plr in game.Players:GetPlayers() do
if player:IsFriendsWith(plr.UserId) then
BadgeService:AwardBadge(player.UserId, BadgeId)
BadgeService:AwardBadge(plr.UserId, BadgeId)
end
end
end)
game.Players.PlayerAdded:Connect(function(player)
for _,plr in pairs(game.Players:GetPlayers()) do
local isFriend=player:IsFriendsWith(plr.UserId)
AwardBadge(player)
AwardBadge(plr)
end
end)