Advertisement
Derek1017

Draw 3D

Jun 23rd, 2015
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.08 KB | None | 0 0
  1. local player = game:GetService("Players").LocalPlayer
  2. player.Character:WaitForChild("Humanoid")
  3.  
  4. local mouse = player:GetMouse()
  5.  
  6. local folder = Instance.new("Folder", player.Character)
  7.  
  8. local part = Instance.new("Part", game:GetService("Workspace").CurrentCamera)
  9. part.Anchored = true
  10. part.FormFactor = "Custom"
  11. part.Size = Vector3.new(100,100,.1)
  12. part.CanCollide = false
  13. part.Transparency = 0.5
  14.  
  15.  
  16. game:GetService("RunService").RenderStepped:connect(function()
  17. part.CFrame = workspace.Camera.CoordinateFrame *CFrame.new(0,0,-50)
  18. end)
  19.  
  20.  
  21. local options = {
  22. color = "White",
  23. size = 0.2
  24. }
  25.  
  26. player.Chatted:connect(function(message)
  27. if string.sub(message:lower(),1,5) == "clear" then
  28. folder:ClearAllChildren()
  29. print("Cleared")
  30. elseif string.sub(message:lower(),1,5) == "size " then
  31. options.size = tonumber(string.sub(message,6,string.len(message))) or 0.2
  32. print(options.size)
  33. elseif string.sub(message:lower(),1,4) == "hide" then
  34. part.Transparency = 1
  35. elseif string.sub(message:lower(),1,4) == "show" then
  36. part.Transparency = 0.5    
  37. elseif string.sub(message:lower(),1,6) == "color " then
  38. options.color = string.sub(message,7,string.len(message))
  39. print(options.color,#options.color)
  40. end
  41. end)
  42.  
  43.  
  44.  
  45.  
  46. local button1down = false
  47.  
  48. game:GetService("UserInputService").InputBegan:connect(function(Input, Bool)
  49. if Input.UserInputType == Enum.UserInputType.MouseButton1 then 
  50. if mouse.Target then   
  51. button1down = false
  52. repeat
  53. local pos = mouse.Hit.p
  54. wait()
  55. local pos2 = mouse.Hit.p
  56. local dist = (pos - pos2).magnitude
  57. local pallet = Instance.new("Part", folder)
  58. pallet.Size = Vector3.new(options.size,options.size,dist)
  59. pallet.Anchored = true
  60. pallet.Locked = true
  61. pallet.TopSurface = "Smooth"
  62. pallet.BottomSurface = "Smooth"
  63. pallet.CanCollide = false
  64. pallet.BrickColor = BrickColor.new(options.color)
  65. pallet.CFrame = CFrame.new(pos,pos2) *CFrame.new(0,0,-dist/2)
  66. until button1down == true
  67. end
  68. end
  69. end)
  70.  
  71.  
  72. game:GetService("UserInputService").InputEnded:connect(function(Input, Bool)
  73. if Input.UserInputType == Enum.UserInputType.MouseButton1 then 
  74. button1down = true
  75. end
  76. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement