nickcool9999

Radial selection via Frame

Jun 15th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. local b = 8
  2.  
  3. local btn = script.Parent.Middle
  4. btn.Visible = false
  5.  
  6. local btns = {}
  7.  
  8. for i = 1, b do
  9.     print(i)
  10.     local nb = btn:Clone()
  11.     btns[#btns+1]=nb
  12.     nb.ImageButton.BackgroundTransparency = 1
  13.     nb.Visible = true
  14.     nb.Rotation = (i-1)*(360/b)
  15.     nb.Parent = script.Parent
  16.     nb.ImageButton.MouseButton1Click:connect(function()
  17.         for x,bt in ipairs(btns) do
  18.             if x ~= i then
  19.                 bt.ImageButton:TweenPosition(UDim2.new(0,-50,0,-520),nil,nil,1)
  20.                 spawn(function()
  21.                     local n = 0
  22.                     local r = bt.Rotation
  23.                     while n<1 do
  24.                         n=n+wait()
  25.                         bt.ImageButton.ImageTransparency = n
  26.                         bt.Rotation = r + (n*180)
  27.                     end
  28.                     bt:Destroy()
  29.                 end)
  30.             else
  31.                 bt.ImageButton:TweenPosition(UDim2.new(0,-50,0,-180),nil,nil,1)
  32.                 spawn(function()
  33.                     local n = 0
  34.                     local r = bt.Rotation
  35.                     while n<1 do
  36.                         n=n+wait()
  37.                         --(math.sin(n*math.pi*15)/4)+.5
  38.                         bt.ImageButton.ImageTransparency = n
  39.                         --bt.Rotation = r + (n*180)
  40.                     end
  41.                     bt:Destroy()
  42.                 end)
  43.             end
  44.         end
  45.     end)
  46. end
Advertisement
Add Comment
Please, Sign In to add comment