Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Player = game.Players.LocalPlayer
- m = Player:GetMouse()
- function Cast(p1,p2)
- return CFrame.new(p1.p,p2.p)*CFrame.new(0,0,-(p1.p-p2.p).magnitude/2),(p1.p-p2.p).magnitude
- end
- Paint = {}
- repeat wait() until Player.Backpack
- local Tool = Instance.new("HopperBin",Player.Backpack)
- Tool.Name = "Paint"
- Color = "Black"
- Drawing = false
- LastPart = nil
- Tool.Selected:connect(function(ms)
- ms.Button1Down:connect(function()
- Drawing = true
- end)
- ms.Button1Up:connect(function()
- Drawing = false
- end)
- end)
- Tool.Deselected:connect(function()
- Drawing = false
- end)
- cy = function()
- local T = tick()
- coroutine.yield(coroutine.resume(coroutine.create(function() end)))
- return tick()-T
- end
- sleep = function(time)
- if not time or time == 0 then
- time = cy()
- end
- local t = 0
- repeat
- local T = tick()
- coroutine.yield(coroutine.resume(coroutine.create(function() end)))
- t = t + (tick()-T)
- until t >= time
- return t
- end
- while sleep(0.005) do
- if Drawing then
- if LastPart then
- local P = Instance.new("Part",Player.Character)
- P.Anchored = true
- P.Transparency = 0.5
- P.FormFactor = "Custom"
- P.Size = Vector3.new(0,0,0)
- P.CFrame = m.Hit
- local Ray,Length = Cast(LastPart.CFrame,P.CFrame)
- local P2 = Instance.new("Part",Player.Character)
- P2.Anchored = true
- P2.Name = "Paint"
- P2.FormFactor = "Custom"
- P2.TopSurface = "Smooth"
- P2.BottomSurface = "Smooth"
- P2.BrickColor = BrickColor.new(Color)
- P2.Size = Vector3.new(0.4,0.4,Length)
- P2.CFrame = Ray
- LastPart = P
- else
- local P = Instance.new("Part",Player.Character)
- P.Anchored = true
- P.Transparency = 0.5
- P.FormFactor = "Custom"
- P.Size = Vector3.new(0,0,0)
- P.CFrame = m.Hit
- LastPart = P
- end
- else
- LastPart = nil
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement