Advertisement
CrimsonSword123

Untitled

Jul 1st, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. bin = script.Parent
  2. local trans = 0
  3. local draw = false
  4. local objects = {}
  5. local color = 23
  6. local height = 0.6
  7. --Set cursor--~
  8. local curs = Instance.new("Part")
  9. curs.formFactor = "Plate"
  10. curs.Shape = "Ball"
  11. curs.BrickColor = BrickColor.new(26)
  12. curs.Size = Vector3.new(1,0.4,1)
  13. -----------------~
  14.  
  15. function sa(msg)
  16. local ms = Instance.new("Message")
  17. ms.Parent = bin.Parent.Parent
  18. ms.Text = msg
  19. wait(1)
  20. ms:remove()
  21. end
  22.  
  23. function move(mouse)
  24. curs.Position = Vector3.new(mouse.Hit.p.x, 0.7, mouse.Hit.p.z)
  25. end
  26.  
  27. function onKeyDown(key)
  28. key = key:lower()
  29. if key == "t" then
  30. trans = trans + 0.1
  31. sa(trans)
  32. end
  33. if key == "g" then
  34. trans = trans - 0.1
  35. sa(trans)
  36. end
  37. if key == "c" then
  38. local g = game.Workspace:getChildren()
  39. for i = 1, #g do
  40. if g[i].Name == ("Brick" ..bin.Parent.Parent.Name) then
  41. g[i]:Remove()
  42. end
  43. end
  44. end
  45. if key == "r" then
  46. if color == 23 then
  47. color = 21
  48. sa("Red")
  49. elseif color == 21 then
  50. color = 37
  51. sa("Green")
  52. elseif color == 37 then
  53. color = 108
  54. sa("Brown")
  55. elseif color == 108 then
  56. color = 1
  57. sa("White")
  58. elseif color == 1 then
  59. color = 26
  60. sa("Black")
  61. else
  62. color = 23
  63. sa("Blue")
  64. end
  65. end
  66. end
  67.  
  68. function onButton1Down(mouse)
  69. curs.BrickColor = BrickColor.new(21)
  70. draw = true
  71. while draw do
  72. local part = Instance.new("Part")
  73. part.Name = "Brick" ..bin.Parent.Parent.Name
  74. part.formFactor = "Plate"
  75. part.Size = Vector3.new(1,.4,1)
  76. part.Position = mouse.Hit.p
  77. part.Position = Vector3.new(part.Position.x, 0.6, part.Position.z)
  78. part.Transparency = trans
  79. part.Anchored = true
  80. part.BrickColor = BrickColor.new(color)
  81. part.Parent = game.Workspace
  82. part:BreakJoints()
  83. wait()
  84. end
  85. end
  86.  
  87. function onButton1Up(mouse)
  88. curs.BrickColor = BrickColor.new(26)
  89. draw = false
  90. end
  91.  
  92. function onSelected(mouse)
  93. color = 23
  94. curs.Parent = game.Workspace
  95. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  96. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  97. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  98. mouse.Idle:connect(function() move(mouse) end)
  99. mouse.KeyDown:connect(onKeyDown)
  100. sa("To change color, Push 'r'.")
  101. sa("To change transparency, Push t to raise; g to lower.")
  102. sa("To restart, push c.")
  103. end
  104.  
  105. function unSelected(mouse)
  106. curs:remove()
  107. end
  108.  
  109. function onF()
  110. if bin == nil then
  111. curs:Remove()
  112. end
  113. end
  114.  
  115. bin.Selected:connect(onSelected)
  116. bin.Deselected:connect(unSelected)
  117. bin.Parent.ChildRemoved:connect(onF)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement