I want to get a font I uploaded from the dev marketplace onto the chat system, I’ve already tried replacing the font Enum in chat settings module but it outputs error:
Key 'Silkscreen' not found in table 't1 where t1 = {| AmaticSC: Enum.Font, Antique: Enum.Font, Arcade: Enum.Font, ... 46 more ... |}'
anybody know what to do?
I think this isn’t possible because you cannot edit Roblox’s core Enums (at least I think) but if anybody has an idea please tell me.
2 Likes
You can try setting the font of all the text labels in the chat Gui. A ScreenGui gets added to the PlayerGui called “Chat”, and it displays the chat window. You can freely edit anything in it, including text labels!
So you can set the font of text labels in it when they get added, and the ones already there on join:
local font = Font.fromEnum(Enum.Font.Cartoon) -- the font to set it to
local bold = Font.fromName("ComicNeueAngular", Enum.FontWeight.Bold) -- the same font, but bolded
-- the bold font is used for username nametags, like "[Player1]: Hello!"
local playerGui = script:FindFirstAncestor("PlayerGui")
local chat = playerGui:WaitForChild("Chat")
local frame = chat:WaitForChild("Frame")
local chatChannelParentFrame = frame:WaitForChild("ChatChannelParentFrame")
local function setFont(label)
if label.ClassName == "TextLabel" or label.ClassName == "TextBox" then
label.FontFace = font
elseif label.ClassName == "TextButton" then
label.FontFace = bold
end
end
-- Set messages font
chatChannelParentFrame.DescendantAdded:Connect(setFont)
for _, desc in pairs(chatChannelParentFrame:GetDescendants()) do
setFont(desc)
end
-- Set chat box font
local chatBarParentFrame = frame:WaitForChild("ChatBarParentFrame")
local newFrame = chatBarParentFrame:WaitForChild("Frame"):WaitForChild("BoxFrame")
local chatBar = newFrame:WaitForChild("Frame")
setFont(chatBar:WaitForChild("ChatBar"))
setFont(chatBar:WaitForChild("MessageMode"))
setFont(chatBar:WaitForChild("TextLabel"))
The only problem with this is that, when a player enters a message in the chat, the message text gets really spaced out away from the nametag. I’m not too sure how to fix this yet. Try it for yourself to see what I mean, I’m too lazy to take a screenshot
1 Like