Advertisement
brandon5487

drawforkingdsds

Apr 13th, 2015
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.58 KB | None | 0 0
  1. --------drawforkingdsds
  2. -----------drawforkingdsds drawforkingdsds drawforkingdsds------------
  3. me = game.Players.LocalPlayer
  4. char = me.Character
  5. hold = false
  6. thickness = 0.5
  7. maxt = 10
  8. bricks = {}
  9.  
  10. color = BrickColor.new("Black")
  11. colors = {}
  12. for i=0,63,1 do
  13.         table.insert(colors, BrickColor.palette(i))
  14. end
  15.  
  16. function checkt()
  17.         if thickness < 0.1 then
  18.                 thickness = 0.1
  19.         end
  20.         if thickness > maxt then
  21.                 thickness = maxt
  22.         end
  23. end
  24.  
  25. function makegui()
  26.         local maxx = 200
  27.         local x = 0
  28.         local y = 0
  29.         local g = Instance.new("ScreenGui")
  30.         g.Name = "Colors"
  31.         local fr = Instance.new("Frame",g)
  32.         fr.Position = UDim2.new(0, 10, 0.3, 0)
  33.         fr.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
  34.         fr.BorderColor3 = Color3.new(0,0,0)
  35.         local txt = nil
  36.         local txt2 = nil
  37.         local txt3 = nil
  38.         for i,v in pairs(colors) do
  39.                 local gah = Instance.new("TextButton",fr)
  40.                 gah.Position = UDim2.new(0, x + 3, 0, y + 3)
  41.                 gah.Size = UDim2.new(0, 25, 0, 25)
  42.                 gah.BackgroundColor = v
  43.                 gah.BorderColor3 = Color3.new(0,0,0)
  44.                 gah.Text = ""
  45.                 gah.MouseButton1Down:connect(function()
  46.                         color = v
  47.                         txt.Text = v.Name
  48.                 end)
  49.                 gah.MouseEnter:connect(function()
  50.                         txt2.Text = v.Name
  51.                 end)
  52.                 gah.MouseLeave:connect(function() txt2.Text = ""
  53.                 end)
  54.                 x = x + 28
  55.                 if x >= maxx then
  56.                         x = 0
  57.                         y = y + 28
  58.                 end
  59.         end
  60.         fr.Size = UDim2.new(0, maxx + 27, 0, y + 40)
  61.         txt = Instance.new("TextLabel",fr)
  62.         txt.Size = UDim2.new(0.95, 0, 0, 35)
  63.         txt.Position = UDim2.new(0.025, 0, 0, y + 3)
  64.         txt.Text = color.Name
  65.         txt.BackgroundColor3 = Color3.new(0.1, 0.1, 0.1)
  66.         txt.BorderColor3 = Color3.new(0, 0, 0)
  67.         txt.TextColor3 = Color3.new(1, 1, 1)
  68.         txt.FontSize = "Size24"
  69.         txt.Font = "ArialBold"
  70.         txt.TextYAlignment = "Bottom"
  71.         txt.TextXAlignment = "Left"
  72.         txt2 = Instance.new("TextLabel",txt)
  73.         txt2.Size = UDim2.new(1, 0, 0, 0)
  74.         txt2.Text = color.Name
  75.         txt2.BackgroundTransparency = 1
  76.         txt2.TextColor3 = Color3.new(1, 1, 1)
  77.         txt2.FontSize = "Size12"
  78.         txt2.TextYAlignment = "Top"
  79.         txt2.TextXAlignment = "Right"
  80.         txt3 = Instance.new("TextLabel",fr)
  81.         txt3.Size = UDim2.new(0.5, 0, 0, 25)
  82.         txt3.Position = UDim2.new(0.25, 0, 1, 0)
  83.         txt3.BackgroundColor3 = Color3.new(0.1, 0.1, 0.1)
  84.         txt3.BorderColor3 = Color3.new(0,0,0)
  85.         txt3.TextColor3 = Color3.new(1,1,1)
  86.         txt3.FontSize = "Size12"
  87.         txt3.Text = thickness
  88.         g.Parent = me.PlayerGui
  89.         coroutine.resume(coroutine.create(function()
  90.                 while g.Parent ~= nil do
  91.                         txt3.Text = thickness
  92.                         wait()
  93.                 end
  94.         end))
  95. end
  96.  
  97. function remgui()
  98.         for i,v in pairs(me.PlayerGui:children()) do
  99.                 if v.Name == "Colors" then v:remove() end
  100.         end
  101. end
  102.  
  103. if script.Parent.className ~= "HopperBin" then
  104.         h = Instance.new("HopperBin",me.Backpack)
  105.         h.Name = "Draw"
  106.         script.Parent = h
  107. end
  108.  
  109. bin = script.Parent
  110.  
  111. function weld(p1, p2)
  112.         local w = Instance.new("Weld")
  113.         w.Part0 = p2
  114.         w.Part1 = p1
  115.         w.C0 = p2.CFrame:toObjectSpace(p1.CFrame)
  116.         w.Parent = p2
  117. end
  118.  
  119. function B1D(mouse)
  120.         hold = true
  121.         coroutine.resume(coroutine.create(function()
  122.                 mouse.Button1Up:wait()
  123.                 hold = false
  124.         end))
  125.         local p = Instance.new("Part",char)
  126.         p.formFactor = "Custom"
  127.         p.Size = Vector3.new(1,0.5,0.5)
  128.         p.Anchored = true
  129.         p.TopSurface = 0
  130.         p.BottomSurface = 0
  131.         p.CanCollide = false
  132.         p.BrickColor = color
  133.         p.Locked = true
  134.         local m = Instance.new("BlockMesh",p)
  135.         local targ = mouse.Target
  136.         table.insert(bricks, p)
  137.         local pos = mouse.Hit.p
  138.         while hold do
  139.                 local mag = (pos - mouse.Hit.p).magnitude
  140.                 m.Scale = Vector3.new(thickness, 0.4, (mag+(thickness/3))*2)
  141.                 p.CFrame = CFrame.new(pos, mouse.Hit.p) * CFrame.new(0, 0, -mag/2 - thickness/5)
  142.                 if mag > thickness/2+0.1 then
  143.                         B1D(mouse)
  144.                         if targ ~= nil then
  145.                                 if targ.Anchored == false then
  146.                                         p.Anchored = false
  147.                                         weld(p, targ)
  148.                                 end
  149.                         end
  150.                         break
  151.                 end
  152.                 wait()
  153.         end
  154. end
  155.  
  156. bin.Selected:connect(function(mouse)
  157.         makegui()
  158.         mouse.KeyDown:connect(function(key)
  159.                 key = key:lower()
  160.                 local kh = true
  161.                 coroutine.resume(coroutine.create(function()
  162.                         mouse.KeyUp:wait()
  163.                         kh = false
  164.                 end))
  165.                 if key == "q" then
  166.                         while kh do
  167.                                 thickness = thickness - 0.1
  168.                                 checkt()
  169.                                 wait()
  170.                         end
  171.                 elseif key == "e" then
  172.                         while kh do
  173.                                 thickness = thickness + 0.1
  174.                                 checkt()
  175.                                 wait()
  176.                         end
  177.                 elseif key == "z" then
  178.                         while kh do
  179.                                 if #bricks > 0 then
  180.                                         bricks[#bricks]:remove()
  181.                                         table.remove(bricks, #bricks)
  182.                                 end
  183.                                 wait()
  184.                         end
  185.                 elseif key == "f" then
  186.                         for i = #bricks, 1, -1 do
  187.                                 bricks[i]:remove()
  188.                                 table.remove(bricks, i)
  189.                         end
  190.                 end
  191.         end)
  192.         mouse.Button1Down:connect(function()
  193.                 B1D(mouse)
  194.         end)
  195. end)
  196.  
  197. bin.Deselected:connect(function()
  198.         remgui()
  199. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement