Advertisement
ERROR_CODE

Untitled

Nov 26th, 2024 (edited)
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.92 KB | None | 0 0
  1. local screenGui = Instance.new("ScreenGui")
  2. screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  3.  
  4. local frame = Instance.new("Frame")
  5. frame.Size = UDim2.new(0, 300, 0, 50) -- Начальный размер Frame
  6. frame.Position = UDim2.new(0.5, -150, 0.5, -25) -- Позиция Frame в центре экрана
  7. frame.BackgroundColor3 = Color3.new(1, 1, 1) -- Белый цвет фона
  8. frame.Parent = screenGui
  9.  
  10. local textLabel = Instance.new("TextLabel")
  11. textLabel.Size = UDim2.new(1, 0, 0, 50)
  12. textLabel.Position = UDim2.new(0, 0, 0, 0)
  13. textLabel.BackgroundColor3 = Color3.new(0.8, 0.8, 0.8)
  14. textLabel.Text = "Начальный текст"
  15. textLabel.TextWrapped = true
  16. textLabel.Parent = frame
  17.  
  18. local function updateSize()
  19. local textService = game:GetService("TextService")
  20. local textSize = textService:GetTextSize(textLabel.Text, textLabel.TextSize, textLabel.Font, Vector2.new(textLabel.AbsoluteSize.X, math.huge))
  21.    
  22. textLabel.Size = UDim2.new(textLabel.Size.X.Scale, textLabel.Size.X.Offset, 0, textSize.Y)
  23.    
  24. frame.Size = UDim2.new(frame.Size.X.Scale, frame.Size.X.Offset, 0, textLabel.Size.Y.Offset)
  25. end
  26.  
  27. textLabel:GetPropertyChangedSignal("Text"):Connect(updateSize)
  28.  
  29. updateSize()
  30.  
  31. wait(3)
  32. textLabel.Text = "Это пример длинного текста, который должен автоматически увеличивать размеры TextLabel и Frame по вертикали..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................."
  33. updateSize()
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement