Hello, i'm making a game with a tag place and you can set different fonts for the tags, the tags work, the only problem is that the chat text is bugged and is under my username, i have been messing around with the chat modules and i got this. Also i'll just put modified source since the chat modules are long and i don't want to give restricted info
DefaultChatMessage - create tags
local function findtag(spk)
return someinvokable:InvokeServer(spk);
end
local needstags,ptags=findtag(fromSpeaker)
if needstags then
for i,v in pairs(ptags.tags) do
local tagdetails=v
if v.show==true then
local tag = tagdetails
local alreadydoing = false
local tc = Color3.fromHSV(tag.tagcolor[1],tag.tagcolor[2],tag.tagcolor[3])
local tagColor = tc or Color3.fromRGB(255, 0, 255)
local tagText = tag.tagtext or "???"
local formatTagText = string.format("[%s] ", tagText)
local label = util:AddTagLabelToBaseMessage(BaseMessage, tagColor, formatTagText,tag.tagfont)
label.Position = guiObjectSpacing
numNeededSpaces = numNeededSpaces + util:GetNumberOfSpaces(formatTagText, tag.tagfont, useTextSize)
guiObjectSpacing = guiObjectSpacing + UDim2.new(0, label.Size.X.Offset, 0, 0)
table.insert(tagLabels, label)
end
end
end
That works, but the text position is not right
Util - support different fonts
function methods:GetStringTextBounds(text, font, textSize, sizeBounds)
sizeBounds = sizeBounds or Vector2.new(10000, 10000)
return TextService:GetTextSize(text, textSize, font, sizeBounds)
end
function methods:AddTagLabelToBaseMessage(BaseMessage, tagColor, formatTagText,fnt)
if not fnt then
fnt=BaseMessage.Font
end
local tagNameSize = self:GetStringTextBounds(formatTagText, fnt, BaseMessage.TextSize)
local TagLabel = self:GetFromObjectPool("TextLabel")
TagLabel.Selectable = false
TagLabel.Size = UDim2.new(0, tagNameSize.X, 0, tagNameSize.Y)
TagLabel.Position = UDim2.new(0, 0, 0, 0)
TagLabel.BackgroundTransparency = 1
TagLabel.Font = fnt
TagLabel.TextSize = BaseMessage.TextSize
TagLabel.TextXAlignment = BaseMessage.TextXAlignment
TagLabel.TextYAlignment = BaseMessage.TextYAlignment
TagLabel.TextTransparency = BaseMessage.TextTransparency
TagLabel.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
TagLabel.TextColor3 = tagColor
TagLabel.Text = formatTagText
TagLabel.Visible = true
TagLabel.Parent = BaseMessage
return TagLabel
end
Here is the result of what i'm doing

1 comment
i've changed the check tags to set extra data, but still doesn't work