Advertisement
Descaii

Paint

Mar 23rd, 2014
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.81 KB | None | 0 0
  1. Player = game.Players.LocalPlayer
  2. m = Player:GetMouse()
  3. function Cast(p1,p2)
  4.     return CFrame.new(p1.p,p2.p)*CFrame.new(0,0,-(p1.p-p2.p).magnitude/2),(p1.p-p2.p).magnitude
  5. end
  6. Paint = {}
  7. repeat wait() until Player.Backpack
  8. local Tool = Instance.new("HopperBin",Player.Backpack)
  9. Tool.Name = "Paint"
  10. Color = "Black"
  11. Drawing = false
  12. LastPart = nil
  13. Tool.Selected:connect(function(ms)
  14.     ms.Button1Down:connect(function()
  15.         Drawing = true
  16.     end)
  17.     ms.Button1Up:connect(function()
  18.         Drawing = false
  19.     end)
  20. end)
  21. Tool.Deselected:connect(function()
  22.     Drawing = false
  23. end)
  24. cy = function()
  25.     local T = tick()
  26.     coroutine.yield(coroutine.resume(coroutine.create(function() end)))
  27.     return tick()-T
  28. end
  29. sleep = function(time)
  30.     if not time or time == 0 then
  31.         time = cy()
  32.     end
  33.     local t = 0
  34.     repeat
  35.         local T = tick()
  36.         coroutine.yield(coroutine.resume(coroutine.create(function() end)))
  37.         t = t + (tick()-T)
  38.     until t >= time
  39.     return t
  40. end
  41. while sleep(0.005) do
  42.     if Drawing then
  43.         if LastPart then
  44.             local P = Instance.new("Part",Player.Character)
  45.             P.Anchored = true
  46.             P.Transparency = 0.5
  47.             P.FormFactor = "Custom"
  48.             P.Size = Vector3.new(0,0,0)
  49.             P.CFrame = m.Hit
  50.             local Ray,Length = Cast(LastPart.CFrame,P.CFrame)
  51.             local P2 = Instance.new("Part",Player.Character)
  52.             P2.Anchored = true
  53.             P2.Name = "Paint"
  54.             P2.FormFactor = "Custom"
  55.             P2.TopSurface = "Smooth"
  56.             P2.BottomSurface = "Smooth"
  57.             P2.BrickColor = BrickColor.new(Color)
  58.             P2.Size = Vector3.new(0.4,0.4,Length)
  59.             P2.CFrame = Ray
  60.             LastPart = P
  61.         else
  62.             local P = Instance.new("Part",Player.Character)
  63.             P.Anchored = true
  64.             P.Transparency = 0.5
  65.             P.FormFactor = "Custom"
  66.             P.Size = Vector3.new(0,0,0)
  67.             P.CFrame = m.Hit
  68.             LastPart = P
  69.         end
  70.     else
  71.         LastPart = nil
  72.     end
  73. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement