Hi, I’ve been trying to create a chat system on roblox, here’s my script:
--NewLine
--Creates a new line at the end of the message
--Define variables
local textBox = script.Parent
local maxCharsConst = 91
local maxChars = 91
local chatBoxFrame = textBox.Parent
local chatBoxFrameSizeY = .055 / 2
local chatBoxFramePosY = chatBoxFrameSizeY
--Create new line event
textBox:GetPropertyChangedSignal("Text"):Connect(function()
if string.len(textBox.Text) >= maxChars + 1 then --Checks when create a new line
--Create new line
chatBoxFrame.Size = chatBoxFrame.Size + UDim2.new(0,0, chatBoxFrameSizeY, 0)
chatBoxFrame.Position = chatBoxFrame.Position + UDim2.new(0,0, -chatBoxFramePosY, 0)
chatBoxFrame.UICorner.CornerRadius -= UDim.new(.005, 0)
maxChars = maxChars + maxCharsConst
end
end)
However, when this script checks how many characters the message has, it counts spaces either, and that’s a problem for this script. Here’s a video:
I know it does this because I’m checking the length of the message, but I can’t find any other method for this…