-- Chat Tagger FE (Local) - Mini Hub -- Intercepta mensagens com TextChatService.OnIncomingMessage e: -- 1) adiciona sua tag local (PrefixText) às suas mensagens, -- 2) remove "fake tags" entre colchetes do início do texto para mensagens de outros. -- Cole em StarterPlayerScripts. local Players = game:GetService("Players") local TextChatService = game:GetService("TextChatService") local TweenService = game:GetService("TweenService") local LocalPlayer = Players.LocalPlayer local PlayerGui = LocalPlayer:WaitForChild("PlayerGui") -- safety: verifica TextChatService if not TextChatService then warn("[ChatTagger] TextChatService não disponível. Script abortado.") return end -- UI (mini hub) local screenGui = Instance.new("ScreenGui") screenGui.Name = "ChatTaggerGui" screenGui.Parent = PlayerGui screenGui.ResetOnSpawn = false local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 300, 0, 120) frame.Position = UDim2.new(0.5, -150, 0.8, -60) frame.BackgroundColor3 = Color3.fromRGB(24,24,30) frame.BorderSizePixel = 0 frame.Parent = screenGui local corner = Instance.new("UICorner", frame); corner.CornerRadius = UDim.new(0,10) local title = Instance.new("TextLabel", frame) title.Size = UDim2.new(1, -20, 0, 28) title.Position = UDim2.new(0,10,0,8) title.BackgroundTransparency = 1 title.Text = "Chat Customizer (local)" title.TextColor3 = Color3.fromRGB(0, 200, 170) title.Font = Enum.Font.GothamBold title.TextSize = 18 title.TextXAlignment = Enum.TextXAlignment.Left local input = Instance.new("TextBox", frame) input.Size = UDim2.new(0.9, 0, 0, 34) input.Position = UDim2.new(0.05,0,0,40) input.PlaceholderText = "[👑VIP]" input.Text = "" input.ClearTextOnFocus = false input.Font = Enum.Font.Gotham input.TextSize = 14 input.TextColor3 = Color3.fromRGB(230,230,230) input.BackgroundColor3 = Color3.fromRGB(36,36,40) local ic = Instance.new("UICorner", input); ic.CornerRadius = UDim.new(0,8) local saveBtn = Instance.new("TextButton", frame) saveBtn.Size = UDim2.new(0.9,0,0,28) saveBtn.Position = UDim2.new(0.05,0,0,80) saveBtn.Text = "Salvar Tag (local)" saveBtn.Font = Enum.Font.GothamBold saveBtn.TextSize = 14 saveBtn.BackgroundColor3 = Color3.fromRGB(0,150,220) local sc = Instance.new("UICorner", saveBtn); sc.CornerRadius = UDim.new(0,8) local Prefix = "[👑VIP]" -- padrão saveBtn.MouseButton1Click:Connect(function() if tostring(input.Text):match("%S") then Prefix = input.Text else Prefix = "[👑VIP]" end saveBtn.Text = "Tag salva: "..Prefix task.delay(1.2, function() saveBtn.Text = "Salvar Tag (local)" end) end) -- animação simples saveBtn.MouseEnter:Connect(function() TweenService:Create(saveBtn, TweenInfo.new(0.18), {BackgroundColor3 = Color3.fromRGB(0,180,255)}):Play() end) saveBtn.MouseLeave:Connect(function() TweenService:Create(saveBtn, TweenInfo.new(0.18), {BackgroundColor3 = Color3.fromRGB(0,150,220)}):Play() end) -- Helper: detecta [TAG] no começo do texto (p.ex. "[VIP] ola") local function stripLeadingBracketTag(text) if not text then return text end -- remove prefix like "[qualquer coisa]" no começo (espaços permitidos) local stripped, found = text:gsub("^%s*%[[^%]]+%]%s*", "") if found > 0 then return stripped, true end return text, false end -- Intercepta mensagens chegando (client-side) -- Retorna TextChatMessageProperties para decorar / modificar o que aparece no cliente. TextChatService.OnIncomingMessage = function(message) if not message then return end local props = Instance.new("TextChatMessageProperties") -- pegar jogador por UserId (exemplo oficial). message.TextSource pode existir. local player = nil if message.TextSource and message.TextSource.UserId then player = Players:GetPlayerByUserId(message.TextSource.UserId) end -- 1) Se for SUA mensagem: adiciona PrefixText (local only) if player == LocalPlayer then -- só coloca se já não tiver PrefixText oficial local existingPrefix = message.PrefixText or "" -- use se quiser cores na tag (Rich Text). TextChat permite HTML tags. props.PrefixText = ("%s %s"):format(Prefix, existingPrefix) return props end -- 2) Mensagens de outros jogadores: detecta "fake tag" textual no começo e remove -- (aplica somente se não existir um PrefixText oficial vindo do servidor) local text = message.Text or "" local hasServerPrefix = (message.PrefixText and tostring(message.PrefixText) ~= "") if not hasServerPrefix then local newText, found = stripLeadingBracketTag(text) if found then -- opcional: você pode mostrar um marcador indicando que foi um fake -- props.PrefixText = "[FAKE] " .. (message.PrefixText or "") props.Text = newText -- devolve texto sem o prefixo entre colchetes return props end end return nil -- sem mudança end print("[ChatTagger] carregado. Use a GUI para configurar sua tag local. (TextChatService)")