So, I’ve been creating a custom chat, and everything works fine. But, the text doesn’t stay the same.
Whenever someone tries to write a full sentence, the text goes smaller and smaller and it get’s hard to read.
I’ve tried TextService:GetTextSize() and formatting it that way, but I keep getting the same error.
10:10:13.941 - Unable to cast token to int
This is the script I’ve been trying to work on.
local events = game:GetService("ReplicatedStorage"):WaitForChild("EventsFunctions")
local chatEvent = events:FindFirstChild("ChatEvent")
local textService = game:GetService("TextService")
local contextType = Enum.TextFilterContext.PublicChat
chatEvent.OnClientEvent:Connect(function(player,msg)
local nameTeplate = game:GetService("ReplicatedStorage"):WaitForChild("NameTemplate"):Clone()
nameTeplate.Parent = script.Parent.MessageHolder
nameTeplate.Name = player.Name
local newSize = textService:GetTextSize(msg,Enum.FontSize.Size14,Enum.Font.SourceSansLight,script.Parent.MessageHolder.AbsoluteSize) --// Error Occurs Here
print(newSize)
end)
This is how I have my TextLabel and TextBox setup.
Everything else works fine, I’m just not sure how to use :GetTextSize() properly and using that, keeping the same text size for larger amounts of characters.
Any help would be appreciated!