Chat Badge script does not work anymore

My Chat Badge script does not work. Is there an way to fix this?

1 Like

you are not calling the onChatted function with player.Chatted

-- ur local function (onChatted)

player.Chatted:Connect(onChatted)
2 Likes

Why overcomplicate things?

local BadgeService = game:GetService("BadgeService")

local badgeMessage = "/e negotiation"
local badgeId = 396452358317449

local function playerAdded(player: Player)
	player.Chatted:Connect(function(message)
		if message:lower() ~= badgeMessage:lower() then return end
		local hasBadge = BadgeService:UserHasBadgeAsync(player.UserId, badgeId)
		if hasBadge then return end
		BadgeService:AwardBadge(player.UserId, badgeId)
	end)
end

for _, player in pairs(game.Players:GetPlayers()) do
	task.spawn(playerAdded, player)
end
game.Players.PlayerAdded:Connect(playerAdded)
3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.