Advertisement
abs_0

Global variables test

Apr 26th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.90 KB | None | 0 0
  1. _G.materializeb = function(buttons, color, transp, speed)
  2.     for i,button in pairs(buttons) do
  3.         local parent = button
  4.         local circlecolor = color or parent.TextColor3
  5.         local ripplespeed = speed or 0.8
  6.         local transparency = transp or 0.85
  7.    
  8.         button = button or script.Parent
  9.         color = color or parent.TextColor3
  10.         speed = speed or 0.8
  11.         transp = transp or 0.85
  12.    
  13.         local mouse = game.Players.LocalPlayer:GetMouse()
  14.         local diagonal = math.sqrt((parent.Size.X.Offset) ^ 2 + (parent.Size.Y.Offset) ^ 2)
  15.         parent.ClipsDescendants = true
  16.         parent.Active = true
  17.         parent.Selectable = true
  18.         parent.Visible = true
  19.         parent.AutoButtonColor = false
  20.    
  21.         -- Object and Properties
  22.         local circle = Instance.new("ImageLabel")
  23.         circle.Name = "CircleLabel"
  24.         circle.Parent = parent
  25.         circle.AnchorPoint = Vector2.new(0.5, 0.5)
  26.         circle.BackgroundColor3 = Color3.new(1,1,1)
  27.         circle.BackgroundTransparency = 1
  28.         circle.BorderSizePixel = 0
  29.         circle.Position = UDim2.new(0,0,0,0)
  30.         circle.Size = UDim2.new(0,50,0,50)
  31.         circle.Visible = false
  32.         circle.Image = "rbxassetid://200182847"
  33.         circle.ImageColor3 = circlecolor
  34.    
  35.        
  36.    
  37.         parent.MouseButton1Down:connect(function()
  38.             --Script
  39.             local x = (mouse.X) - (parent.AbsolutePosition.X)
  40.             local y = (mouse.Y) - (parent.AbsolutePosition.Y)
  41.             circle.Position = UDim2.new(0,x,0,y)
  42.             circle.Size = UDim2.new(0,5,0,5) -- edit this to make it bigger before animation
  43.             circle.ImageTransparency = transparency
  44.             circle.Visible = true
  45.            
  46.             wait()
  47.            
  48.             circle:TweenSize(
  49.                 UDim2.new(0, diagonal * 2, 0, diagonal * 2),
  50.                 "Out",
  51.                 "Quad",
  52.                 ripplespeed
  53.             )
  54.         end)
  55.    
  56.         parent.MouseButton1Up:connect(function()
  57.             wait(0.3)
  58.             local TweenService = game:GetService("TweenService")
  59.             local circ = circle
  60.            
  61.             local Info = TweenInfo.new(
  62.                 0.2, -- changes length of fading circle
  63.                 Enum.EasingStyle.Linear,
  64.                 Enum.EasingDirection.Out,
  65.                 0,
  66.                 false,
  67.                 0
  68.             )
  69.             local Goals =
  70.             {
  71.                 ImageTransparency = 1;
  72.             }
  73.            
  74.             local tween = TweenService:Create(circ,Info,Goals)
  75.             tween:Play()
  76.         end)
  77.     end
  78. end
  79.  
  80. _G.materializet = function(textbox, color, revertedtext)
  81.     local parent = textbox
  82.     local mouse = game.Players.LocalPlayer:GetMouse()
  83.     local underlinecolor = color or parent.TextColor3
  84.     local ptext = revertedtext or "TextBox"
  85.  
  86.     local xsize = parent.Size.X.Offset
  87.     local ysize = parent.Size.Y.Offset
  88.     parent.Visible = true
  89.     parent.Active = true
  90.     parent.Selectable = true
  91.  
  92.     local Underline = Instance.new("Frame")
  93.     local UnderlineBase = Instance.new("Frame")
  94.  
  95.     Underline.Name = "Underline"
  96.     Underline.Parent = parent
  97.     Underline.BackgroundColor3 = underlinecolor
  98.     Underline.BorderSizePixel = 0
  99.     Underline.Position = UDim2.new(0, 0, 1, 0)
  100.     Underline.Size = UDim2.new(0, 0, 0, 2)
  101.  
  102.     UnderlineBase.Name = "UnderlineBase"
  103.     UnderlineBase.Parent = parent
  104.     UnderlineBase.BackgroundColor3 = underlinecolor
  105.     UnderlineBase.BackgroundTransparency = 0.85
  106.     UnderlineBase.BorderSizePixel = 0
  107.     UnderlineBase.Position = UDim2.new(0, 0, 1, 0)
  108.     UnderlineBase.Size = UDim2.new(0, xsize, 0, 1)
  109.  
  110.     parent.Focused:connect(function()
  111.         local x = (mouse.X) - (parent.AbsolutePosition.X)
  112.         Underline.BackgroundTransparency = 0
  113.         Underline.Position = UDim2.new(0,x,1,0)
  114.         wait()
  115.         Underline:TweenSizeAndPosition(
  116.             UDim2.new(0, xsize, 0, 1),
  117.             UDim2.new(0, 0, 1, 0),
  118.             "Out",
  119.             "Quint",
  120.             0.2
  121.         )
  122.     end)
  123.  
  124.     parent.FocusLost:connect(function()
  125.         if parent.Text == "" then
  126.             parent.Text = ptext
  127.         end
  128.        
  129.         local TweenService = game:GetService("TweenService")
  130.        
  131.         local Info = TweenInfo.new(
  132.             0.15,
  133.             Enum.EasingStyle.Linear,
  134.             Enum.EasingDirection.Out,
  135.             0,
  136.             false,
  137.             0
  138.         )
  139.         local Goals =
  140.         {
  141.             BackgroundTransparency = 1;
  142.         }
  143.        
  144.         local tween = TweenService:Create(Underline,Info,Goals)
  145.         tween:Play()
  146.        
  147.         wait(0.15)
  148.         Underline.Size = UDim2.new(0,0,0,1)
  149.     end)
  150. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement