I am trying to make per-bubble custom chat bubbles, following the script here:
https://create.roblox.com/docs/chat/bubble-chat
However, adornee comes out as nil. This hasn’t been an issue before
I am trying to make per-bubble custom chat bubbles, following the script here:
https://create.roblox.com/docs/chat/bubble-chat
However, adornee comes out as nil. This hasn’t been an issue before
If adornee is coming through as nil, that usually means the BubbleChat system wasn’t able to attach the bubble to a specific part yet. With the new TextChatService, this can happen more often than before because the BubbleChatMessageAdded event doesn’t always provide a BasePart as the adornee.
A few common reasons:
A safe approach is to resolve the adornee manually:
local function resolveAdornee(a)
if not a then return nil end
if a:IsA("BasePart") then return a end
if a:IsA("Model") then
return a:FindFirstChild("Head") or a.PrimaryPart
end
if a:IsA("Humanoid") then
local model = a.Parent
return model and (model:FindFirstChild("Head") or model.PrimaryPart)
end
return nil
end
TextChatService.BubbleChatMessageAdded:Connect(function(message)
local adornee = resolveAdornee(message.Adornee)
if not adornee then
warn("Could not resolve adornee for bubble:", message.Text)
return
end
-- Apply your per-bubble customization here
end)
This should make your script resilient to all the different adornee types the new chat system can provide
adornee isn’t a member of message.Adornee, so i substituted it for the adornee in
game:GetService(“TextChatService”).OnBubbleAdded = function(message, adornee), but it always fails to resolve
OnBubbleAdded is part of the legacy BubbleChat API, and its parameters don’t match the new TextChatService events. With the new system, BubbleChatMessageAdded only gives you a single argument (message), and the adornee is inside message.Adornee. There is no second parameter anymore.
If message.Adornee is nil, substituting the old OnBubbleAdded signature won’t fix it — the new API simply doesn’t provide an adornee in some cases.
A few situations where this happens:
You need to resolve the adornee manually instead of relying on the old callback signature. Something like this works reliably:
local TextChatService = game:GetService("TextChatService")
local function resolveAdornee(a)
if not a then return nil end
if a:IsA("BasePart") then return a end
if a:IsA("Model") then
return a:FindFirstChild("Head") or a.PrimaryPart
end
if a:IsA("Humanoid") then
local model = a.Parent
return model and (model:FindFirstChild("Head") or model.PrimaryPart)
end
return nil
end
TextChatService.BubbleChatMessageAdded:Connect(function(message)
local adornee = resolveAdornee(message.Adornee)
if not adornee then
warn("Could not resolve adornee for:", message.Text)
return
end
-- Apply your bubble customization here
end)
This avoids the old OnBubbleAdded pattern entirely and handles all the new adornee types the system can return