Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local parent = script.Parent
- local mouse = game.Players.LocalPlayer:GetMouse()
- local xsize = parent.Size.X.Offset
- local ysize = parent.Size.Y.Offset
- parent.Visible = true
- parent.Active = true
- parent.Selectable = true
- local Underline = Instance.new("Frame")
- local UnderlineBase = Instance.new("Frame")
- Underline.Name = "Underline"
- Underline.Parent = parent
- Underline.BackgroundColor3 = parent.TextColor3
- Underline.BorderSizePixel = 0
- Underline.Position = UDim2.new(0, 0, 1, 0)
- Underline.Size = UDim2.new(0, 0, 0, 1)
- UnderlineBase.Name = "UnderlineBase"
- UnderlineBase.Parent = parent
- UnderlineBase.BackgroundColor3 = parent.TextColor3
- UnderlineBase.BackgroundTransparency = 0.85
- UnderlineBase.BorderSizePixel = 0
- UnderlineBase.Position = UDim2.new(0, 0, 1, 0)
- UnderlineBase.Size = UDim2.new(0, xsize, 0, 1)
- parent.Focused:connect(function()
- if Underline.Size == UDim2.new(0, 0, 0, 1) then
- local x = (mouse.X) - (parent.AbsolutePosition.X)
- Underline.BackgroundTransparency = 0
- Underline.Position = UDim2.new(0,x,1,0)
- wait()
- Underline:TweenSizeAndPosition(
- UDim2.new(0, xsize, 0, 1),
- UDim2.new(0, 0, 1, 0),
- "Out",
- "Quint",
- 0.2
- )
- end
- end)
- parent.FocusLost:connect(function()
- if parent.Text == "" then
- parent.Text = "TextBox"
- end
- local TweenService = game:GetService("TweenService")
- local Info = TweenInfo.new(
- 0.15,
- Enum.EasingStyle.Linear,
- Enum.EasingDirection.Out,
- 0,
- false,
- 0
- )
- local Goals =
- {
- BackgroundTransparency = 1;
- }
- local tween = TweenService:Create(Underline,Info,Goals)
- tween:Play()
- wait(0.15)
- Underline.Size = UDim2.new(0,0,0,1)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement