Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local screenGui = Instance.new("ScreenGui")
- screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 300, 0, 50) -- Начальный размер Frame
- frame.Position = UDim2.new(0.5, -150, 0.5, -25) -- Позиция Frame в центре экрана
- frame.BackgroundColor3 = Color3.new(1, 1, 1) -- Белый цвет фона
- frame.Parent = screenGui
- local textLabel = Instance.new("TextLabel")
- textLabel.Size = UDim2.new(1, 0, 0, 50)
- textLabel.Position = UDim2.new(0, 0, 0, 0)
- textLabel.BackgroundColor3 = Color3.new(0.8, 0.8, 0.8)
- textLabel.Text = "Начальный текст"
- textLabel.TextWrapped = true
- textLabel.Parent = frame
- local function updateSize()
- local textService = game:GetService("TextService")
- local textSize = textService:GetTextSize(textLabel.Text, textLabel.TextSize, textLabel.Font, Vector2.new(textLabel.AbsoluteSize.X, math.huge))
- textLabel.Size = UDim2.new(textLabel.Size.X.Scale, textLabel.Size.X.Offset, 0, textSize.Y)
- frame.Size = UDim2.new(frame.Size.X.Scale, frame.Size.X.Offset, 0, textLabel.Size.Y.Offset)
- end
- textLabel:GetPropertyChangedSignal("Text"):Connect(updateSize)
- updateSize()
- wait(3)
- textLabel.Text = "Это пример длинного текста, который должен автоматически увеличивать размеры TextLabel и Frame по вертикали..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................."
- updateSize()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement