Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Point(UD1,UD2)
- local X=UD1.X-UD2.X
- local Y=UD1.Y-UD2.Y
- local Hyp=math.sqrt(X^2+Y^2)
- local AS=math.atan2(Y,X)
- return 360*(AS/(math.pi*2)),Hyp
- end
- Player = game.Players.LocalPlayer
- Mouse = Player:GetMouse()
- PlayerGui = Player:WaitForChild("PlayerGui")
- local Screen = Instance.new("ScreenGui",PlayerGui)
- Rings = {}
- function NewRing(Size,Position,Screen,MS)
- if not Rings then
- Rings = {}
- end
- local BallID=167984434
- local RingID=167984464
- local B1 = Instance.new("ImageLabel",Screen)
- local B2 = Instance.new("ImageButton",Screen)
- B1.Image = "http://www.roblox.com/asset/?id="..RingID-1
- B2.Image = "http://www.roblox.com/asset/?id="..BallID-1
- local S = Size
- B1.Size = UDim2.new(0,S,0,S)
- B1.Position = Position
- B1.BackgroundTransparency = 1
- B2.Size = UDim2.new(0,50,0,50)
- B2.BackgroundTransparency = 1
- B2.Position = B1.Position
- B2.ZIndex = 2
- local C = {}
- C.B1 = B1
- C.B2 = B2
- C.Rot = 0
- C.Size = S
- C.Position = Position
- C.Dragging = false
- C.MS = MS
- local Dragging = false
- B2.MouseButton1Down:connect(function()
- C.Dragging = true
- end)
- MS.Button1Up:connect(function()
- C.Dragging = false
- end)
- B2.MouseButton1Up:connect(function()
- C.Dragging = false
- end)
- function C:Update()
- --print("Upd")
- B1.Size = UDim2.new(0,C.Size,0,C.Size)
- local a = C.Position-UDim2.new(0,B1.AbsoluteSize.X/2,0,B1.AbsoluteSize.Y/2)
- B1.Position = a
- if C.Dragging then
- local N = Point(B1.AbsolutePosition+Vector2.new(B1.AbsoluteSize.X/2,B1.AbsoluteSize.Y/2),Vector2.new(Mouse.X,Mouse.Y))
- C.Rot = N
- end
- 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))))
- C.Off = Off
- local g = B1.Position+UDim2.new(0,B1.AbsoluteSize.X/2,0,B1.AbsoluteSize.Y/2)
- C.g = g
- local n = UDim2.new(0,B2.AbsoluteSize.X/2,0,B2.AbsoluteSize.Y/2)
- C.n = n
- B2.Position = g-Off-n
- end
- table.insert(Rings,C)
- return C
- end
- local B3 = Instance.new("Frame",Screen)
- B3.Size = UDim2.new(0,150,0,150)
- B3.Draggable = true
- B3.Active = true
- local D = NewRing((B3.AbsoluteSize.X+B3.AbsoluteSize.Y),B3.Position,Screen,Mouse)
- game:GetService("RunService").RenderStepped:connect(function()
- D.Position = B3.Position+UDim2.new(0,B3.AbsoluteSize.X/2,0,B3.AbsoluteSize.Y/2)
- D:Update()
- B3.Rotation = D.Rot
- --B1.Rotation = Rot
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement