Advertisement
tcl1

[ROBLOX Lua] CFrame Plugin

Jan 24th, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.37 KB | None | 0 0
  1. -- Setup
  2. Gui = Instance.new("ScreenGui",game:GetService("CoreGui"))
  3. Gui.Name = "CFrameGui"
  4. Frame = Instance.new("Frame",Gui)
  5.     Frame.Name = "GuiFrame"
  6.     Frame.Style = "RobloxSquare"
  7.     Frame.Position = UDim2.new(0,7,0,10)
  8.     Frame.Size = UDim2.new(0,200,0,100)
  9. IncrementButton = Instance.new("TextBox",Frame)
  10.     IncrementButton.BackgroundColor3 = Color3.new(0,0,0)
  11.     IncrementButton.BorderColor3 = Color3.new(170,0,0)
  12.     IncrementButton.Position = UDim2.new(0,140,0,25)
  13.     IncrementButton.Size = UDim2.new(0,50,0,30)
  14.     IncrementButton.Name = "incrementbutton"
  15.     IncrementButton.Text = " "
  16.     IncrementButton.Font = "ArialBold"
  17.     IncrementButton.FontSize = "Size12"
  18.     IncrementButton.TextColor3 = BrickColor.new("White").Color
  19. CloseButton = Instance.new("TextButton",Frame)
  20.     CloseButton.BackgroundColor3 = Color3.new(0,0,0)
  21.     CloseButton.BorderColor3 = Color3.new(170,0,0)
  22.     CloseButton.Position = UDim2.new(0,0,0,65)
  23.     CloseButton.Size = UDim2.new(0,50,0,10)
  24.     CloseButton.Name = "closebutton"
  25.     CloseButton.Text = "CLOSE"
  26.     CloseButton.Font = "ArialBold"
  27.     CloseButton.FontSize = "Size12"
  28.     CloseButton.TextColor3 = BrickColor.new("White").Color
  29. MoveButton = Instance.new("TextButton",Frame)
  30.     MoveButton.BackgroundColor3 = Color3.new(0,0,0)
  31.     MoveButton.BorderColor3 = Color3.new(170,0,0)
  32.     MoveButton.Position = UDim2.new(0,0,0,50)
  33.     MoveButton.Size = UDim2.new(0,50,0,10)
  34.     MoveButton.Name = "movebutton"
  35.     MoveButton.Text = "MOVE"
  36.     MoveButton.Font = "ArialBold"
  37.     MoveButton.FontSize = "Size11"
  38.     MoveButton.TextColor3 = BrickColor.new("White").Color
  39. XButton = Instance.new("TextButton",Frame)
  40.     XButton.BackgroundColor3 = Color3.new(0,0,0)
  41.     XButton.BorderColor3 = Color3.new(170,0,0)
  42.     XButton.Position = UDim2.new(0,0,0,22)
  43.     XButton.Size = UDim2.new(0,10,0,10)
  44.     XButton.Name = "xbutton"
  45.     XButton.Text = "X"
  46.     XButton.Font = "ArialBold"
  47.     XButton.FontSize = "Size11"
  48.     XButton.TextColor3 = BrickColor.new("White").Color
  49. YButton = Instance.new("TextButton",Frame)
  50.     YButton.BackgroundColor3 = Color3.new(0,0,0)
  51.     YButton.BorderColor3 = Color3.new(170,0,0)
  52.     YButton.Position = UDim2.new(0,12,0,22)
  53.     YButton.Size = UDim2.new(0,10,0,10)
  54.     YButton.Name = "ybutton"
  55.     YButton.Text = "Y"
  56.     YButton.Font = "ArialBold"
  57.     YButton.FontSize = "Size11"
  58.     YButton.TextColor3 = BrickColor.new("White").Color
  59. ZButton = Instance.new("TextButton",Frame)
  60.     ZButton.BackgroundColor3 = Color3.new(0,0,0)
  61.     ZButton.BorderColor3 = Color3.new(170,0,0)
  62.     ZButton.Position = UDim2.new(0,24,0,22)
  63.     ZButton.Size = UDim2.new(0,10,0,10)
  64.     ZButton.Name = "zbutton"
  65.     ZButton.Text = "Z"
  66.     ZButton.Font = "ArialBold"
  67.     ZButton.FontSize = "Size11"
  68.     ZButton.TextColor3 = BrickColor.new("White").Color
  69. IncrementTtl = Instance.new("TextLabel",Frame)
  70.     IncrementTtl.BackgroundTransparency = 1
  71.     IncrementTtl.Name = "incrementttl"
  72.     IncrementTtl.Position = UDim2.new(0,139,0,47)
  73.     IncrementTtl.Size = UDim2.new(0,50,0,30)
  74.     IncrementTtl.Font = "ArialBold"
  75.     IncrementTtl.FontSize = "Size12"
  76.     IncrementTtl.Text = "Increment"
  77.     IncrementTtl.TextColor3 = BrickColor.new("White").Color
  78. Status = Instance.new("TextLabel",Frame)
  79.     Status.BackgroundColor3 = Color3.new(91,91,91)
  80.     Status.BorderColor3 = Color3.new(91,91,91)
  81.     Status.Position = UDim2.new(0,-7,0,-7)
  82.     Status.Size = UDim2.new(0,198,0,20)
  83.     Status.Font = "ArialBold"
  84.     Status.FontSize = "Size18"
  85.     Status.Text = "CFraming - Moving"
  86.     Status.TextColor3 = BrickColor.new("White").Color
  87.     Status.TextXAlignment = "Left"
  88. PlusButton = Instance.new("TextButton",Frame)
  89.     PlusButton.Size = UDim2.new(0,10,0,10)
  90.     PlusButton.Position = UDim2.new(0,36,0,22)
  91.     PlusButton.BackgroundColor3 = Color3.new(0,0,0)
  92.     PlusButton.BorderColor3 = Color3.new(170,0,0)
  93.     PlusButton.Text = "+"
  94.     PlusButton.Font = "ArialBold"
  95.     PlusButton.TextColor3 = BrickColor.new("White").Color
  96.     PlusButton.FontSize = "Size18"
  97. MinusButton = Instance.new("TextButton",Frame)
  98.     MinusButton.Size = UDim2.new(0,10,0,10)
  99.     MinusButton.Position = UDim2.new(0,48,0,22)
  100.     MinusButton.BackgroundColor3 = Color3.new(0,0,0)
  101.     MinusButton.BorderColor3 = Color3.new(170,0,0)
  102.     MinusButton.Text = "-"
  103.     MinusButton.Font = "ArialBold"
  104.     MinusButton.TextColor3 = BrickColor.new("White").Color
  105.     MinusButton.FontSize = "Size18"
  106. ----------
  107. axis = {
  108.     x = false;
  109.     y = false;
  110.     z = false;
  111. }
  112.  
  113. settings = {
  114.     positive = true;
  115.     negative = false;
  116. }
  117.  
  118. XButton.MouseButton1Down:connect(function() axis.x = true axis.y = false axis.z = false end)
  119. YButton.MouseButton1Down:connect(function() axis.x = false axis.y = true axis.z = false end)
  120. ZButton.MouseButton1Down:connect(function() axis.x = false axis.y = false axis.z = true end)
  121.  
  122. PlusButton.MouseButton1Down:connect(function() settings.positive = true settings.negative = false end)
  123. MinusButton.MouseButton1Down:connect(function() settings.positive = false settings.negative = true end)
  124.  
  125. CloseButton.MouseButton1Down:connect(function() Gui:Destroy() end)
  126.  
  127. MoveButton.MouseButton1Down:connect(function()
  128.     if axis.x == true then
  129.         local ln = game.Selection:Get()
  130.         if #ln == 0 then print("ERROR: No objects selected") return end
  131.         for i = 1, #ln do
  132.             if tonumber(IncrementButton.Text) ~= nil then
  133.                 if settings.positive == true then ln[i].CFrame = CFrame.new(ln[i].CFrame.x+tonumber(IncrementButton.Text),ln[i].CFrame.y,ln[i].CFrame.z) end
  134.                 if settings.negative == true then ln[i].CFrame = CFrame.new(ln[i].CFrame.x-tonumber(IncrementButton.Text),ln[i].CFrame.y,ln[i].CFrame.z) end   
  135.             end
  136.         end
  137.     end
  138.     if axis.y == true then
  139.         local ln2 = game.Selection:Get()
  140.         if #ln2 == 0 then print("ERROR: No objects selected") return end
  141.         for i = 1, #ln2 do
  142.             if tonumber(IncrementButton.Text) ~= nil then
  143.                 if settings.positive == true then ln2[i].CFrame = CFrame.new(ln2[i].CFrame.x,ln2[i].CFrame.y+tonumber(IncrementButton.Text),ln2[i].CFrame.z) end
  144.                 if settings.negative == true then ln2[i].CFrame = CFrame.new(ln2[i].CFrame.x,ln2[i].CFrame.y-tonumber(IncrementButton.Text),ln2[i].CFrame.z) end       
  145.             end
  146.         end
  147.     end
  148.     if axis.z == true then
  149.         local ln3 = game.Selection:Get()
  150.         if #ln3 == 0 then print("ERROR: No objects selected") return end
  151.         for i = 1, #ln3 do
  152.             if tonumber(IncrementButton.Text) ~= nil then
  153.                 if settings.positive == true then ln3[i].CFrame = CFrame.new(ln3[i].CFrame.x,ln3[i].CFrame.y,ln3[i].CFrame.z+tonumber(IncrementButton.Text)) end
  154.                 if settings.negative == true then ln3[i].CFrame = CFrame.new(ln3[i].CFrame.x,ln3[i].CFrame.y,ln3[i].CFrame.z-tonumber(IncrementButton.Text)) end
  155.             end
  156.         end
  157.     end
  158. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement