Recently there were changes to text layout which broke the ChatBar in a couple of my games. I’ve had to fix it twice, and seen that others are experiencing the same issues.
Note: This glitch only happens to people with custom chat systems. It appears that the ‘ChatBar’ script was updated, somehow causing old scripts to not function properly. All we’re doing is taking the new ChatBar script and replacing the old one with it.
Open both your broken game, and an empty baseplate note, you can skip steps 2 & 3 if you just download the script from ChatBar.rbxm (6.9 KB)
Use Play Solo on the empty baseplate
Go to Chat > ChatScript > ChatMain and copy the script called ‘ChatBar’
Put the ChatBar script into the same location in your broken game, and remove the one that was already there.
If you have implemented a custom chatbar style incorrectly, that style may be removed, so back up the old script first to enable you to port that across.
Add the measureSize function and modify the CalculateSize function as follows:
local function measureSize(textObj)
return TextService:GetTextSize(
textObj.Text,
textObj.TextSize,
textObj.Font,
Vector2.new(textObj.AbsoluteSize.X, 10000)
)
end
function methods:CalculateSize()
if self.CalculatingSizeLock then
return
end
self.CalculatingSizeLock = true
local textSize = nil
local bounds = nil
if self:IsFocused() or self.TextBox.Text ~= "" then
textSize = self.TextBox.TextSize
bounds = measureSize(self.TextBox).Y
else
textSize = self.TextLabel.TextSize
bounds = measureSize(self.TextLabel).Y
end
local newTargetYSize = bounds - textSize
if (self.TargetYSize ~= newTargetYSize) then
self.TargetYSize = newTargetYSize
self:TweenToTargetYSize()
end
self.CalculatingSizeLock = false
end
This is completely unrelated to the new PlayerScripts, it just happens that a change to text layout was made the same week. I just want to point that out so we don’t have people reverting to old PlayerScripts because of unrelated Chat system issues.