Advertisement
dainel

Draw Script FE

Dec 27th, 2019
10,599
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do
  6. print("FE Compatibility code V2 by Mokiros")
  7. local RealPlayer = RealPlayer
  8. script.Parent = RealPlayer.Character
  9.  
  10. --Fake event to make stuff like Mouse.KeyDown work
  11. local Disconnect_Function = function(this)
  12. this[1].Functions[this[2]] = nil
  13. end
  14. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  15. local FakeEvent_Metatable = {__index={
  16. Connect = function(this,f)
  17. local i = tostring(math.random(0,10000))
  18. while this.Functions[i] do
  19. i = tostring(math.random(0,10000))
  20. end
  21. this.Functions[i] = f
  22. return setmetatable({this,i},Disconnect_Metatable)
  23. end
  24. }}
  25. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  26. local function fakeEvent()
  27. return setmetatable({Functions={}},FakeEvent_Metatable)
  28. end
  29.  
  30. --Creating fake input objects with fake variables
  31. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  32. FakeMouse.keyUp = FakeMouse.KeyUp
  33. FakeMouse.keyDown = FakeMouse.KeyDown
  34. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  35. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  36. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  37. end}
  38. --Merged 2 functions into one by checking amount of arguments
  39. CAS.UnbindAction = CAS.BindAction
  40.  
  41. --This function will trigger the events that have been :Connect()'ed
  42. local function TriggerEvent(self,ev,...)
  43. for _,f in pairs(self[ev].Functions) do
  44. f(...)
  45. end
  46. end
  47. FakeMouse.TriggerEvent = TriggerEvent
  48. UIS.TriggerEvent = TriggerEvent
  49.  
  50. --Client communication
  51. local Event = Instance.new("RemoteEvent")
  52. Event.Name = "UserInput_Event"
  53. Event.OnServerEvent:Connect(function(plr,io)
  54. if plr~=RealPlayer then return end
  55. FakeMouse.Target = io.Target
  56. FakeMouse.Hit = io.Hit
  57. if not io.isMouse then
  58. local b = io.UserInputState == Enum.UserInputState.Begin
  59. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  60. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  61. end
  62. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  63. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  64. end
  65. for _,t in pairs(CAS.Actions) do
  66. for _,k in pairs(t.Keys) do
  67. if k==io.KeyCode then
  68. t.Function(t.Name,io.UserInputState,io)
  69. end
  70. end
  71. end
  72. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  73. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  74. end
  75. end)
  76. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  77. local Mouse = owner:GetMouse()
  78. local UIS = game:GetService("UserInputService")
  79. local input = function(io,RobloxHandled)
  80. if RobloxHandled then return end
  81. --Since InputObject is a client-side instance, we create and pass table instead
  82. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  83. end
  84. UIS.InputBegan:Connect(input)
  85. UIS.InputEnded:Connect(input)
  86.  
  87. local h,t
  88. --Give the server mouse data every second frame, but only if the values changed
  89. --If player is not moving their mouse, client won't fire events
  90. local HB = game:GetService("RunService").Heartbeat
  91. while true do
  92. if h~=Mouse.Hit or t~=Mouse.Target then
  93. h,t=Mouse.Hit,Mouse.Target
  94. Event:FireServer({isMouse=true,Target=t,Hit=h})
  95. end
  96. --Wait 2 frames
  97. for i=1,2 do
  98. HB:Wait()
  99. end
  100. end]==],script)
  101.  
  102. ----Sandboxed game object that allows the usage of client-side methods and services
  103. --Real game object
  104. local RealGame = game
  105.  
  106. --Metatable for fake service
  107. local FakeService_Metatable = {
  108. __index = function(self,k)
  109. local s = rawget(self,"_RealService")
  110. if s then
  111. return typeof(s[k])=="function"
  112. and function(_,...)return s[k](s,...)end or s[k]
  113. end
  114. end,
  115. __newindex = function(self,k,v)
  116. local s = rawget(self,"_RealService")
  117. if s then s[k]=v end
  118. end
  119. }
  120. local function FakeService(t,RealService)
  121. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  122. return setmetatable(t,FakeService_Metatable)
  123. end
  124.  
  125. --Fake game object
  126. local FakeGame = {
  127. GetService = function(self,s)
  128. return rawget(self,s) or RealGame:GetService(s)
  129. end,
  130. Players = FakeService({
  131. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  132. },"Players"),
  133. UserInputService = FakeService(UIS,"UserInputService"),
  134. ContextActionService = FakeService(CAS,"ContextActionService"),
  135. RunService = FakeService({
  136. _btrs = {},
  137. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  138. BindToRenderStep = function(self,name,_,fun)
  139. self._btrs[name] = self.Heartbeat:Connect(fun)
  140. end,
  141. UnbindFromRenderStep = function(self,name)
  142. self._btrs[name]:Disconnect()
  143. end,
  144. },"RunService")
  145. }
  146. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  147. FakeGame.service = FakeGame.GetService
  148. FakeService(FakeGame,game)
  149. --Changing owner to fake player object to support owner:GetMouse()
  150. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  151. end
  152. -- Toggle : [=] (enable / disable drawing)
  153. -- Undo : [Z] (remove last drawn line in canvas)
  154. -- Draw : [Left Click] (draw)
  155. -- Clear : [F] (clear canvas)
  156. -- Rainbow : [R] (toggle rainbow color drawings)
  157. -- Neon Glow : [X] (toggle glowing drawings)
  158. -- Other in GUI
  159. -- Toxicity : [Q] (toggle toxicity aka kills people)
  160.  
  161. local plr = game:GetService("Players").LocalPlayer
  162. char = plr.Character
  163. mouse = plr:GetMouse()
  164.  
  165. function tween(object,style,direction,t,goal)
  166. local tweenservice = game:GetService("TweenService")
  167. local tweenInfo = TweenInfo.new(t,Enum.EasingStyle[style],Enum.EasingDirection[direction])
  168. local tween = tweenservice:Create(object,tweenInfo,goal)
  169. tween:Play()
  170. return tween
  171. end
  172.  
  173. enabled = true
  174.  
  175. local pgui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  176.  
  177. GUI = Instance.new("ScreenGui")
  178. GUI.ResetOnSpawn = false
  179. Frame1 = Instance.new("Frame")
  180. TextLabel2 = Instance.new("TextLabel")
  181. Frame3 = Instance.new("Frame")
  182. Frame4 = Instance.new("Frame")
  183. Frame5 = Instance.new("Frame")
  184. Frame6 = Instance.new("Frame")
  185. TextLabel7 = Instance.new("TextLabel")
  186. TextLabel8 = Instance.new("TextLabel")
  187. TextLabel9 = Instance.new("TextLabel")
  188. TextLabel10 = Instance.new("TextLabel")
  189. Frame11 = Instance.new("Frame")
  190. Frame12 = Instance.new("Frame")
  191. Frame13 = Instance.new("Frame")
  192. Frame14 = Instance.new("Frame")
  193. Frame15 = Instance.new("Frame")
  194. Frame16 = Instance.new("Frame")
  195. ImageButton17 = Instance.new("ImageButton")
  196. TextLabel18 = Instance.new("TextLabel")
  197. ImageButton19 = Instance.new("ImageButton")
  198. LocalScript20 = Instance.new("LocalScript")
  199. Color3Value21 = Instance.new("Color3Value")
  200. TextLabel22 = Instance.new("TextLabel")
  201. TextLabel23 = Instance.new("TextLabel")
  202. TextLabel24 = Instance.new("TextLabel")
  203. TextLabel25 = Instance.new("TextLabel")
  204. GUI.Parent = pgui
  205. Frame1.Name = "Settings"
  206. Frame1.Parent = GUI
  207. Frame1.Transparency = 0.80000001192093
  208. Frame1.Size = UDim2.new(0, 191, 0, 130)
  209. Frame1.Position = UDim2.new(0, 266, 0, 130)
  210. Frame1.Active = true
  211. Frame1.BackgroundColor3 = Color3.new(0.0470588, 0.0509804, 0.0588235)
  212. Frame1.BackgroundTransparency = 0.80000001192093
  213. Frame1.BorderColor3 = Color3.new(1, 1, 1)
  214. Frame1.BorderSizePixel = 0
  215. Frame1.Draggable = true
  216. TextLabel2.Parent = Frame1
  217. TextLabel2.Size = UDim2.new(0, 191, 0, 15)
  218. TextLabel2.Text = "Neodymn's Draw Tool"
  219. TextLabel2.Position = UDim2.new(0, 0, 0, 5)
  220. TextLabel2.BackgroundColor3 = Color3.new(1, 1, 1)
  221. TextLabel2.BackgroundTransparency = 1
  222. TextLabel2.Font = Enum.Font.SourceSansBold
  223. TextLabel2.TextSize = 22
  224. TextLabel2.TextColor3 = Color3.new(1, 1, 1)
  225. TextLabel2.TextStrokeColor3 = Color3.new(1, 1, 1)
  226. TextLabel2.TextWrapped = false
  227. Frame3.Parent = Frame1
  228. Frame3.Size = UDim2.new(0, 3, 1, 0)
  229. Frame3.Position = UDim2.new(0, -3, 0, 0)
  230. Frame3.BackgroundColor3 = Color3.new(1, 1, 1)
  231. Frame3.BorderSizePixel = 0
  232. Frame4.Parent = Frame1
  233. Frame4.Size = UDim2.new(0, 3, 1, 0)
  234. Frame4.Position = UDim2.new(1, 0, 0, 0)
  235. Frame4.BackgroundColor3 = Color3.new(1, 1, 1)
  236. Frame4.BorderSizePixel = 0
  237. Frame5.Parent = Frame1
  238. Frame5.Size = UDim2.new(1, 0, 0, 3)
  239. Frame5.Position = UDim2.new(0, 0, 0, -3)
  240. Frame5.BackgroundColor3 = Color3.new(1, 1, 1)
  241. Frame5.BorderSizePixel = 0
  242. Frame6.Parent = Frame1
  243. Frame6.Size = UDim2.new(1, 0, 0, 3)
  244. Frame6.Position = UDim2.new(0, 0, 1, 0)
  245. Frame6.BackgroundColor3 = Color3.new(1, 1, 1)
  246. Frame6.BorderSizePixel = 0
  247. TextLabel7.Parent = Frame1
  248. TextLabel7.Size = UDim2.new(0, 95, 0, 25)
  249. TextLabel7.Text = "Thickness (m/n)"
  250. TextLabel7.Position = UDim2.new(0, 5, 0, 25)
  251. TextLabel7.BackgroundColor3 = Color3.new(1, 1, 1)
  252. TextLabel7.BackgroundTransparency = 1
  253. TextLabel7.Font = Enum.Font.SourceSansBold
  254. TextLabel7.TextSize = 20
  255. TextLabel7.TextColor3 = Color3.new(1, 1, 1)
  256. TextLabel7.TextStrokeColor3 = Color3.new(1, 1, 1)
  257. TextLabel7.TextXAlignment = Enum.TextXAlignment.Left
  258. TextLabel8.Parent = Frame1
  259. TextLabel8.Size = UDim2.new(0, 95, 0, 25)
  260. TextLabel8.Text = "Can Collide (c)"
  261. TextLabel8.Position = UDim2.new(0, 5, 0, 50)
  262. TextLabel8.BackgroundColor3 = Color3.new(1, 1, 1)
  263. TextLabel8.BackgroundTransparency = 1
  264. TextLabel8.Font = Enum.Font.SourceSansBold
  265. TextLabel8.TextSize = 20
  266. TextLabel8.TextColor3 = Color3.new(1, 1, 1)
  267. TextLabel8.TextStrokeColor3 = Color3.new(1, 1, 1)
  268. TextLabel8.TextXAlignment = Enum.TextXAlignment.Left
  269. TextLabel9.Parent = Frame1
  270. TextLabel9.Size = UDim2.new(0, 95, 0, 25)
  271. TextLabel9.Text = "Opacity (b/v)"
  272. TextLabel9.Position = UDim2.new(0, 5, 0, 75)
  273. TextLabel9.BackgroundColor3 = Color3.new(1, 1, 1)
  274. TextLabel9.BackgroundTransparency = 1
  275. TextLabel9.Font = Enum.Font.SourceSansBold
  276. TextLabel9.TextSize = 20
  277. TextLabel9.TextColor3 = Color3.new(1, 1, 1)
  278. TextLabel9.TextStrokeColor3 = Color3.new(1, 1, 1)
  279. TextLabel9.TextXAlignment = Enum.TextXAlignment.Left
  280. TextLabel10.Parent = Frame1
  281. TextLabel10.Size = UDim2.new(0, 95, 0, 25)
  282. TextLabel10.Text = "Color (r)"
  283. TextLabel10.Position = UDim2.new(0, 5, 0, 100)
  284. TextLabel10.BackgroundColor3 = Color3.new(1, 1, 1)
  285. TextLabel10.BackgroundTransparency = 1
  286. TextLabel10.Font = Enum.Font.SourceSansBold
  287. TextLabel10.TextSize = 20
  288. TextLabel10.TextColor3 = Color3.new(1, 1, 1)
  289. TextLabel10.TextStrokeColor3 = Color3.new(1, 1, 1)
  290. TextLabel10.TextXAlignment = Enum.TextXAlignment.Left
  291. Frame11.Name = "Color"
  292. Frame11.Parent = Frame1
  293. Frame11.Transparency = 0.80000001192093
  294. Frame11.Size = UDim2.new(0, 121, 0, 115)
  295. Frame11.Position = UDim2.new(0, 201, 0, 15)
  296. Frame11.BackgroundColor3 = Color3.new(0.0470588, 0.0509804, 0.0588235)
  297. Frame11.BackgroundTransparency = 0.80000001192093
  298. Frame11.BorderColor3 = Color3.new(1, 1, 1)
  299. Frame11.BorderSizePixel = 0
  300. Frame11.Draggable = true
  301. Frame12.Parent = Frame11
  302. Frame12.Size = UDim2.new(0, 3, 1, 0)
  303. Frame12.Position = UDim2.new(1, 0, 0, 0)
  304. Frame12.BackgroundColor3 = Color3.new(1, 1, 1)
  305. Frame12.BorderSizePixel = 0
  306. Frame13.Parent = Frame11
  307. Frame13.Size = UDim2.new(1, 0, 0, 3)
  308. Frame13.Position = UDim2.new(0, 0, 0, -3)
  309. Frame13.BackgroundColor3 = Color3.new(1, 1, 1)
  310. Frame13.BorderSizePixel = 0
  311. Frame14.Parent = Frame11
  312. Frame14.Size = UDim2.new(1, 0, 0, 3)
  313. Frame14.Position = UDim2.new(0, 0, 1, 0)
  314. Frame14.BackgroundColor3 = Color3.new(1, 1, 1)
  315. Frame14.BorderSizePixel = 0
  316. Frame15.Parent = Frame11
  317. Frame15.Size = UDim2.new(0, 3, 1, 0)
  318. Frame15.Position = UDim2.new(0, -3, 0, 0)
  319. Frame15.BackgroundColor3 = Color3.new(1, 1, 1)
  320. Frame15.BorderSizePixel = 0
  321. Frame16.Name = "Picker"
  322. Frame16.Parent = Frame11
  323. Frame16.Transparency = 1
  324. Frame16.Size = UDim2.new(0, 286, 0, 255)
  325. Frame16.Position = UDim2.new(0, -372, 0, -55)
  326. Frame16.BackgroundColor3 = Color3.new(0.498039, 0.247059, 0.247059)
  327. Frame16.BackgroundTransparency = 1
  328. Frame16.BorderColor3 = Color3.new(0, 0, 0)
  329. ImageButton17.Name = "SV"
  330. ImageButton17.Parent = Frame16
  331. ImageButton17.Size = UDim2.new(0, 101, 0, 105)
  332. ImageButton17.Position = UDim2.new(0, 377, 0, 60)
  333. ImageButton17.BackgroundColor3 = Color3.new(1, 0, 0)
  334. ImageButton17.BorderColor3 = Color3.new(0, 0, 0)
  335. ImageButton17.BorderSizePixel = 0
  336. ImageButton17.AutoButtonColor = false
  337. ImageButton17.Image = "http://www.roblox.com/asset/?id=42462986"
  338. TextLabel18.Name = "Locator"
  339. TextLabel18.Parent = ImageButton17
  340. TextLabel18.Text = "o"
  341. TextLabel18.Position = UDim2.new(0.5, 0, 0.5, 0)
  342. TextLabel18.BorderColor3 = Color3.new(0, 0, 0)
  343. TextLabel18.FontSize = Enum.FontSize.Size12
  344. TextLabel18.TextColor3 = Color3.new(1, 1, 1)
  345. ImageButton19.Name = "H"
  346. ImageButton19.Parent = Frame16
  347. ImageButton19.Size = UDim2.new(0, 10, 0, 105)
  348. ImageButton19.Position = UDim2.new(0, 477, 0, 60)
  349. ImageButton19.BorderColor3 = Color3.new(0, 0, 0)
  350. ImageButton19.BorderSizePixel = 0
  351. ImageButton19.AutoButtonColor = false
  352. ImageButton19.Image = "http://www.roblox.com/asset/?id=42463044"
  353. LocalScript20.Parent = Frame16
  354. Color3Value21.Name = "Col"
  355. Color3Value21.Parent = Frame11
  356. TextLabel22.Name = "ColorT"
  357. TextLabel22.Parent = Frame1
  358. TextLabel22.Size = UDim2.new(0, 65, 0, 25)
  359. TextLabel22.Text = "0, 0, 0"
  360. TextLabel22.Position = UDim2.new(0, 126, 0, 100)
  361. TextLabel22.BackgroundColor3 = Color3.new(1, 1, 1)
  362. TextLabel22.BackgroundTransparency = 1
  363. TextLabel22.Font = Enum.Font.SourceSansBold
  364. TextLabel22.TextSize = 20
  365. TextLabel22.TextColor3 = Color3.new(1, 1, 1)
  366. TextLabel22.TextScaled = true
  367. TextLabel22.TextStrokeColor3 = Color3.new(1, 1, 1)
  368. TextLabel22.TextWrapped = true
  369. TextLabel23.Name = "Transparent"
  370. TextLabel23.Parent = Frame1
  371. TextLabel23.Size = UDim2.new(0, 25, 0, 25)
  372. TextLabel23.Text = "0"
  373. TextLabel23.Position = UDim2.new(0, 146, 0, 75)
  374. TextLabel23.BackgroundColor3 = Color3.new(1, 1, 1)
  375. TextLabel23.BackgroundTransparency = 1
  376. TextLabel23.Font = Enum.Font.SourceSansBold
  377. TextLabel23.TextSize = 20
  378. TextLabel23.TextColor3 = Color3.new(1, 1, 1)
  379. TextLabel23.TextStrokeColor3 = Color3.new(1, 1, 1)
  380. TextLabel23.TextWrapped = true
  381. TextLabel24.Name = "CanCollide"
  382. TextLabel24.Parent = Frame1
  383. TextLabel24.Size = UDim2.new(0, 55, 0, 25)
  384. TextLabel24.Text = "false"
  385. TextLabel24.Position = UDim2.new(0, 131, 0, 50)
  386. TextLabel24.BackgroundColor3 = Color3.new(1, 1, 1)
  387. TextLabel24.BackgroundTransparency = 1
  388. TextLabel24.Font = Enum.Font.SourceSansBold
  389. TextLabel24.TextSize = 20
  390. TextLabel24.TextColor3 = Color3.new(1, 1, 1)
  391. TextLabel24.TextStrokeColor3 = Color3.new(1, 1, 1)
  392. TextLabel24.TextWrapped = true
  393. TextLabel25.Name = "Thickness"
  394. TextLabel25.Parent = Frame1
  395. TextLabel25.Size = UDim2.new(0, 25, 0, 25)
  396. TextLabel25.Text = "1"
  397. TextLabel25.Position = UDim2.new(0, 146, 0, 25)
  398. TextLabel25.BackgroundColor3 = Color3.new(1, 1, 1)
  399. TextLabel25.BackgroundTransparency = 1
  400. TextLabel25.Font = Enum.Font.SourceSansBold
  401. TextLabel25.TextSize = 20
  402. TextLabel25.TextColor3 = Color3.new(1, 1, 1)
  403. TextLabel25.TextStrokeColor3 = Color3.new(1, 1, 1)
  404. TextLabel25.TextWrapped = true
  405.  
  406. presets = GUI.Settings
  407. colors = presets.Color
  408.  
  409. function round(num, numDecimalPlaces)
  410. local mult = 10^(numDecimalPlaces or 0)
  411. return tostring(math.floor(num * mult + 0.5) / mult)
  412. end
  413.  
  414. spawn(function()
  415. local frame = colors.Picker
  416. local sv = frame.SV
  417. local h = frame.H
  418. local locator = sv.Locator
  419.  
  420. local hue = 0
  421. local saturation = 0.5
  422. local value = 0.5
  423.  
  424. local changingHue = false
  425. local changingSv = false
  426.  
  427. function getRGBfromHue()
  428. local r,g,b = 0,0,0
  429. if hue>=120 and hue<=240 then r = 0
  430. elseif hue>=300 or hue<=60 then r = 1
  431. elseif hue>60 and hue<120 then r = 1-(hue-60)/60
  432. elseif hue>240 and hue<300 then r = (hue-240)/60
  433. end
  434.  
  435. if hue>=240 and hue<=360 then g = 0
  436. elseif hue>=60 and hue<=180 then g = 1
  437. elseif hue>180 and hue<240 then g = 1-(hue-180)/60
  438. elseif hue<60 then g = hue/60
  439. end
  440.  
  441. if hue<=120 then b = 0
  442. elseif hue>=180 and hue<=300 then b = 1
  443. elseif hue>120 and hue<180 then b = (hue-120)/60
  444. elseif hue>300 and hue<360 then b = 1-(hue-300)/60
  445. end
  446. return r,g,b
  447. end
  448.  
  449. function changeHue(x,y)
  450. if not changingHue then return end
  451. hue = 360*(1-(y-h.AbsolutePosition.y)/h.AbsoluteSize.y)+85
  452.  
  453. local r,g,b = getRGBfromHue()
  454.  
  455. sv.BackgroundColor3 = Color3.new(r,g,b)
  456. toRGB()
  457. end
  458.  
  459. function changeSv(x,y)
  460. if not changingSv then return end
  461. local x,y = x-sv.AbsolutePosition.x,y-sv.AbsolutePosition.y-35
  462. locator.Position = UDim2.new(0,x,0,y)
  463. if y>=(sv.AbsoluteSize.y)/2 then locator.TextColor3 = Color3.new(1,1,1) else locator.TextColor3 = Color3.new(0,0,0) end
  464. saturation,value = 1-(x/sv.AbsoluteSize.x), 1-(y/sv.AbsoluteSize.y)
  465. toRGB()
  466. end
  467.  
  468. function toRGB()
  469. local r,g,b = getRGBfromHue()
  470.  
  471. local max = math.max(r,g,b)
  472. r,g,b = value*(r+saturation*(max-r)),value*(g+saturation*(max-g)),value*(b+saturation*(max-b))
  473.  
  474.  
  475. colors.Col.Value = Color3.new(r,g,b)
  476. end
  477.  
  478. h.MouseButton1Down:connect(function(x,y) changingHue = true changeHue(x,y) end)
  479. h.MouseButton1Up:connect(function() changingHue = false end)
  480. h.MouseMoved:connect(changeHue)
  481.  
  482. sv.MouseButton1Down:connect(function(x,y) changingSv = true changeSv(x,y) end)
  483. sv.MouseButton1Up:connect(function() changingSv = false end)
  484. sv.MouseMoved:connect(changeSv)
  485. end)
  486.  
  487. spawn(function()
  488. while wait() do
  489. if transparency < 0 then transparency = 0 end
  490. if transparency > 1 then transparency = 0 end
  491. color = colors.Col.Value
  492. local c = color
  493. if c.r < 0 then
  494. c = Color3.new(0,c.g,c.b)
  495. end
  496. if c.g < 0 then
  497. c = Color3.new(c.r,0,c.b)
  498. end
  499. if c.b < 0 then
  500. c = Color3.new(c.r,c.g,0)
  501. end
  502. if c.r > 1 then
  503. c = Color3.new(1,c.g,c.b)
  504. end
  505. if c.g > 1 then
  506. c = Color3.new(c.r,1,c.b)
  507. end
  508. if c.b > 1 then
  509. c = Color3.new(c.r,c.g,1)
  510. end
  511. color = c
  512. colors.Col.Value = c
  513. presets.ColorT.Text = round(color.r,1)..", "..round(color.g,1)..", "..round(color.b,1)
  514. presets.Transparent.Text = tostring(transparency)
  515. local th = tostring(thickness)
  516. if thickness < 0.15 then
  517. th = '0.1'
  518. end
  519. presets.Thickness.Text = tostring(th)
  520. presets.CanCollide.Text = tostring(canCollide)
  521. end
  522. end)
  523.  
  524. local UIS = game:GetService("UserInputService")
  525. UIS.InputEnded:connect(function(k,g)
  526. if k.KeyCode == Enum.KeyCode.Equals and not g then
  527. enabled = not enabled
  528. end
  529. end)
  530.  
  531. drawings = Instance.new("Model",workspace)
  532. drawings.Name = "Drawings"
  533.  
  534. lastd = nil
  535.  
  536. spawn(function()
  537. while wait() do
  538. mouse = plr:GetMouse()
  539. if drawings == nil then
  540. drawings = Instance.new("Model",workspace)
  541. drawings.Name = "Drawings"
  542. end
  543. if drawings.Parent ~= workspace then
  544. drawings.Parent = workspace
  545. end
  546. end
  547. end)
  548.  
  549. canCollide = false
  550. canStack = false
  551. thickness = 1
  552. color = Color3.new(1,0,0)
  553. transparency = 0
  554. interval = 0.1
  555. rainbow = false
  556.  
  557.  
  558. lastm = nil
  559.  
  560. drawing = false
  561.  
  562. neon = false
  563.  
  564.  
  565. local zDown = false
  566.  
  567. mdown = false
  568. ndown = false
  569. bdown = false
  570. vdown = false
  571.  
  572. spawn(function()
  573. while wait() do
  574. if ndown == true then
  575. if not (thickness < 0.2) then
  576. thickness = thickness - 0.2
  577. end
  578. end
  579. if mdown == true then
  580. if (thickness < 20) then
  581. thickness = thickness + 0.2
  582. end
  583. end
  584. if bdown == true then
  585. if (transparency < 0.9) then
  586. transparency = transparency + 0.1
  587. wait(0.1)
  588. end
  589. end
  590. if vdown == true then
  591. if (transparency > 0) then
  592. transparency = transparency - 0.1
  593. end
  594. if string.sub(tostring(transparency),1,3) == "2.7" then transparency = 0 end
  595. wait(0.1)
  596. end
  597. end
  598. end)
  599. killer = false
  600. mouse.KeyDown:connect(function(k)
  601. if enabled == false then return end
  602. local key = k:lower()
  603. if key == "m" then
  604. mdown = true
  605. end
  606. if key == "q" then
  607. killer = not killer
  608. end
  609. if key == "n" then
  610. ndown = true
  611. end
  612. if key == "x" then
  613. neon = not neon
  614. end
  615. if key == "b" then
  616. bdown = true
  617. end
  618. if key == "v" then
  619. vdown = true
  620. end
  621. if key == "z" then
  622. zDown = true
  623. local draw = drawings[#drawings:GetChildren()]
  624. if not draw then return end
  625. draw:Destroy()
  626. end
  627. if key == "f" then
  628. drawings:ClearAllChildren()
  629. end
  630. if key == "r" then
  631. rainbow = not rainbow
  632. end
  633. if key == "c" then
  634. canCollide = not canCollide
  635. end
  636. end)
  637.  
  638. mouse.KeyUp:connect(function(k)
  639. local key = k:lower()
  640. if key == "m" then
  641. mdown = false
  642. end
  643. if key == "n" then
  644. ndown = false
  645. end
  646. if key == "b" then
  647. bdown = false
  648. end
  649. if key == "v" then
  650. vdown = false
  651. end
  652. if key == "z" then
  653. zDown = false
  654. end
  655. end)
  656.  
  657. local uis = game:GetService("UserInputService")
  658. uis.InputBegan:connect(function(k,g)
  659. if g then return end
  660. if k.UserInputType == Enum.UserInputType.MouseButton1 then
  661. drawing = true
  662. end
  663. end)
  664. uis.InputEnded:connect(function(k,g)
  665. if k.UserInputType == Enum.UserInputType.MouseButton1 then
  666. drawing = false
  667. end
  668. end)
  669.  
  670. spawn(function()
  671. while wait() do
  672. if zDown == true then
  673. local zWasUp = false
  674. local n = 0
  675. repeat wait() if zDown == false then zWasUp = true end n = n + 0.5 until n >= 10
  676. if zDown == true and zWasUp == false then
  677. repeat
  678. game:GetService("RunService").RenderStepped:Wait()
  679. pcall(function()
  680. local draw = drawings[#drawings:GetChildren()]
  681. draw:Destroy()
  682. end)
  683. until zDown == false
  684. end
  685. end
  686. end
  687. end)
  688.  
  689. mouse.TargetFilter = drawings
  690. ldraw = nil
  691. game:GetService("RunService").RenderStepped:connect(function()
  692. if drawing == false then
  693. lastm = mouse.Hit.p
  694. ldraw = nil
  695. end
  696. print(drawing)
  697. if drawing == true and (lastm ~= mouse.Hit.p) and enabled then
  698. local mp = mouse.Hit.p
  699. local mh = mouse.Hit
  700. local mt = mouse.Target
  701. if not ldraw then lastm = mp end
  702. if true then
  703. if (mp - lastm).magnitude < thickness*1.5 and ldraw then return end
  704. local draw = Instance.new("Part",drawings)
  705. draw.Name = #drawings:GetChildren()
  706. draw.Anchored = true
  707. draw.CanCollide = canCollide
  708. if neon then
  709. draw.Material = "Neon"
  710. else
  711. draw.Material = "SmoothPlastic"
  712. end
  713. draw.Transparency = transparency
  714. draw.CFrame = CFrame.new((lastm + mouse.Hit.p)/2,lastm)
  715.  
  716. draw.Size = Vector3.new(0,0,(lastm - mp).magnitude)
  717. tween(draw, "Sine", "Out", 0.1, {
  718. Size = Vector3.new(thickness,thickness,(lastm - mp).magnitude)
  719. })
  720. local orr = draw.Size
  721.  
  722. if killer then
  723. coroutine.resume(coroutine.create(function()
  724. local oz = Vector3.new(thickness,thickness,(lastm - mp).magnitude)
  725. while draw and draw.Parent == drawings do
  726. local t = tween(draw, "Sine", "InOut", 0.5, {
  727. Size = oz * 1.2 + Vector3.new(0.25,0.25,0)
  728. })
  729. t.Completed:Wait(0)
  730. local t = tween(draw, "Sine", "InOut", 0.5, {
  731. Size = oz
  732. })
  733. t.Completed:Wait(0)
  734. end
  735. end))
  736. end
  737.  
  738. if rainbow == false then
  739. draw.Color = color
  740. else
  741. local start = 0
  742. spawn(function()
  743. local rs = 1
  744. while game:GetService("RunService").RenderStepped:Wait() do
  745. game:GetService("RunService").RenderStepped:Wait()
  746. game:GetService("RunService").RenderStepped:Wait()
  747. if draw == nil or draw.Parent == nil then break end
  748. rs = rs + 0.2
  749. local r = (math.sin(start/2)/2)+0.5
  750. local g = (math.sin(start)/2)+0.5
  751. local b = (math.sin(start*1.5)/2)+0.5
  752. local color3 = Color3.new(r, g, b)
  753. draw.Color = color3
  754. start = start + interval + math.abs(math.sin(rs))/10
  755. end
  756. end)
  757. end
  758. ldraw = draw
  759. end
  760. end
  761. lastm = mouse.Hit.p
  762. end)
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement