I'm currently making a custom chat for use in my game. Only problem for me is I want the players name text label and chat tag text label to scale dependant on the string.len() function. Is their any way to possibly make this happen?
Don't use string.len, because some characters are different sizes, so we can't just assume they're all the same. Thankfully, roblox calculates these sizes for us and gives us a method to get those sizes. To get the length of a string in pixels, you use TextService:GetTextSize
Here's very roughly how you would implement this in your code:
local TextService = game:GetService("TextService") ... local Size = TextService:GetTextSize(message,fontSize,font,chatFrameSize) ChatMessageObject.Size = UDim2.new(0,Size.x,0,Size.y) --Sets width and height in pixels