Any way to make a limit on the number of word of text in textlabel?

Well, I want to make something like the above ,

  1. If the text length is more than 6 words , then the text of the textlabel will become blank (aka TextLabel.Text = “”)
  2. If the text length is more than 6 words , then the text of the textlabel will only show the first 6 words
    3.If it is a TextLabel which player can enter something in it, if the player type 6 words already ,the TextLabel will stop him on texting
    Hope I can get a understandable solution! :smiley:
local TextLabel = --your text location
TextLabel:GetPropertyChangedSignal("Text"):Connect(function()
   if #(TextLabel.Text) > 6 then
      TextLabel.Text = ""
   end
end)
local TextLabel = --your text location
TextLabel:GetPropertyChangedSignal("Text"):Connect(function()
   if #(TextLabel.Text) > 6 then
      TextLabel.Text = string.sub(TextLabel.Text, 1, 6)
   end
end)
local TextBox = --your text location
TextBox:GetPropertyChangedSignal("Text"):Connect(function()
   if #(TextBox .Text) > 6 then
      TextBox:ReleaseFocus()
      TextBox.Text = string.sub(TextBox.Text, 1, 6)
   end
end)
3 Likes