RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"make a script to make chat messages in different colours when players acquire specific badges."
-- server script local Players = game:GetService("Players") local BadgeService = game:GetService("BadgeService") local badgeId1 = 123456789 -- replace with your badge ID local badgeId2 = 987654321 -- replace with your badge ID local function onPlayerAdded(player) player.Chatted:Connect(function(message) local badge1 = false local badge2 = false local success1, hasBadge1 = pcall(function() return BadgeService:UserHasBadgeAsync(player.UserId, badgeId1) end) local success2, hasBadge2 = pcall(function() return BadgeService:UserHasBadgeAsync(player.UserId, badgeId2) end) if success1 and hasBadge1 then badge1 = true end if success2 and hasBadge2 then badge2 = true end local chatColor = Color3.new(1, 1, 1) -- default white color if badge1 then chatColor = Color3.fromRGB(255, 0, 0) -- red color for badge 1 elseif badge2 then chatColor = Color3.fromRGB(0, 255, 0) -- green color for badge 2 end game:GetService("Chat"):Chat(player.Character.Head, message, chatColor) end) end Players.PlayerAdded:Connect(onPlayerAdded)