Advertisement
Descaii

Gui editer

Jul 24th, 2014
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.33 KB | None | 0 0
  1. function Point(UD1,UD2)
  2. local X=UD1.X-UD2.X
  3. local Y=UD1.Y-UD2.Y
  4. local Hyp=math.sqrt(X^2+Y^2)
  5. local AS=math.atan2(Y,X)
  6. return 360*(AS/(math.pi*2)),Hyp
  7. end
  8. Player = game.Players.LocalPlayer
  9. Mouse = Player:GetMouse()
  10. PlayerGui = Player:WaitForChild("PlayerGui")
  11. local Screen = Instance.new("ScreenGui",PlayerGui)
  12. Rings = {}
  13. function NewRing(Size,Position,Screen,MS)
  14.     if not Rings then
  15.         Rings = {}
  16.     end
  17.     local BallID=167984434
  18.     local RingID=167984464
  19.     local B1 = Instance.new("ImageLabel",Screen)
  20.     local B2 = Instance.new("ImageButton",Screen)
  21.     B1.Image = "http://www.roblox.com/asset/?id="..RingID-1
  22.     B2.Image = "http://www.roblox.com/asset/?id="..BallID-1
  23.     local S = Size
  24.     B1.Size = UDim2.new(0,S,0,S)
  25.     B1.Position = Position
  26.     B1.BackgroundTransparency = 1
  27.     B2.Size = UDim2.new(0,50,0,50)
  28.     B2.BackgroundTransparency = 1
  29.     B2.Position = B1.Position
  30.     B2.ZIndex = 2
  31.     local C = {}
  32.     C.B1 = B1
  33.     C.B2 = B2
  34.     C.Rot = 0
  35.     C.Size = S
  36.     C.Position = Position
  37.     C.Dragging = false
  38.     C.MS = MS
  39.     local Dragging = false
  40.     B2.MouseButton1Down:connect(function()
  41.         C.Dragging = true
  42.     end)
  43.     MS.Button1Up:connect(function()
  44.         C.Dragging = false
  45.     end)
  46.     B2.MouseButton1Up:connect(function()
  47.         C.Dragging = false
  48.     end)
  49.     function C:Update()
  50.         --print("Upd")
  51.         B1.Size = UDim2.new(0,C.Size,0,C.Size)
  52.         local a = C.Position-UDim2.new(0,B1.AbsoluteSize.X/2,0,B1.AbsoluteSize.Y/2)
  53.         B1.Position = a
  54.         if C.Dragging then
  55.             local N = Point(B1.AbsolutePosition+Vector2.new(B1.AbsoluteSize.X/2,B1.AbsoluteSize.Y/2),Vector2.new(Mouse.X,Mouse.Y))
  56.             C.Rot = N
  57.         end
  58.         local Off = UDim2.new(0,math.cos(math.rad(C.Rot))*((C.Size/2)-(C.Size*(10/300))),0,math.sin(math.rad(C.Rot))*((C.Size/2)-(C.Size*(10/300))))
  59.         C.Off = Off
  60.         local g = B1.Position+UDim2.new(0,B1.AbsoluteSize.X/2,0,B1.AbsoluteSize.Y/2)
  61.         C.g = g
  62.         local n = UDim2.new(0,B2.AbsoluteSize.X/2,0,B2.AbsoluteSize.Y/2)
  63.         C.n = n
  64.         B2.Position = g-Off-n
  65.     end
  66.     table.insert(Rings,C)
  67.     return C
  68. end
  69. local B3 = Instance.new("Frame",Screen)
  70. B3.Size = UDim2.new(0,150,0,150)
  71. B3.Draggable = true
  72. B3.Active = true
  73. local D = NewRing((B3.AbsoluteSize.X+B3.AbsoluteSize.Y),B3.Position,Screen,Mouse)
  74. game:GetService("RunService").RenderStepped:connect(function()
  75.     D.Position = B3.Position+UDim2.new(0,B3.AbsoluteSize.X/2,0,B3.AbsoluteSize.Y/2)
  76.     D:Update()
  77.     B3.Rotation = D.Rot
  78.     --B1.Rotation = Rot
  79. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement