Advertisement
oatmeal2009

Draw FE

Aug 28th, 2019
1,988
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.54 KB | None | 0 0
  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. -- Objects
  153. MIDI = Instance.new("ScreenGui")
  154. Frame = Instance.new("Frame")
  155. ID = Instance.new("TextBox")
  156. Play = Instance.new("TextButton")
  157. Dark = Instance.new("TextButton")
  158. Bright = Instance.new("TextButton")
  159. Stop = Instance.new("TextButton")
  160. Hide = Instance.new("TextButton")
  161. Set = Instance.new("TextButton")
  162. BColor = Instance.new("TextBox")
  163. Random = Instance.new("TextButton")
  164. Material = Instance.new("TextBox")
  165. Trans = Instance.new("TextBox")
  166. sound = Instance.new("Sound",game.Players.LocalPlayer.Character.Torso)
  167. sound.Volume = 4
  168. sound.Looped = true
  169. BVal = "Deep orange"
  170. MVal = "Neon"
  171. TVal = 0
  172. Active = false
  173.  
  174. -- Properties
  175.  
  176. MIDI.Name = "MIDI"
  177. MIDI.Parent = game.Players.LocalPlayer.PlayerGui
  178.  
  179. Frame.Parent = MIDI
  180. Frame.Active = true
  181. Frame.BackgroundColor3 = Color3.new(0, 0, 0)
  182. Frame.BackgroundTransparency = 0.5799999833107
  183. Frame.BorderSizePixel = 0
  184. Frame.Draggable = true
  185. Frame.Position = UDim2.new(0, 300, 0, 50)
  186. Frame.Size = UDim2.new(0, 310, 0, 200)
  187.  
  188. ID.Name = "ID"
  189. ID.Parent = Frame
  190. ID.BackgroundColor3 = Color3.new(1, 1, 1)
  191. ID.BorderSizePixel = 0
  192. ID.Position = UDim2.new(0, 100, 0, 10)
  193. ID.Size = UDim2.new(0, 120, 0, 30)
  194. ID.Font = Enum.Font.Arcade
  195. ID.FontSize = Enum.FontSize.Size18
  196. ID.Text = "639837244"
  197. ID.TextColor3 = Color3.new(0, 0, 0)
  198. ID.TextSize = 18
  199.  
  200. Material.Name = "Material"
  201. Material.Parent = Frame
  202. Material.BackgroundColor3 = Color3.new(1, 1, 1)
  203. Material.BorderSizePixel = 0
  204. Material.Position = UDim2.new(0, 210, 0, 95)
  205. Material.Size = UDim2.new(0, 90, 0, 15)
  206. Material.Font = Enum.Font.Arcade
  207. Material.FontSize = Enum.FontSize.Size14
  208. Material.Text = "Neon"
  209. Material.TextSize = 14
  210.  
  211. Trans.Name = "Trans"
  212. Trans.Parent = Frame
  213. Trans.BackgroundColor3 = Color3.new(1, 1, 1)
  214. Trans.BorderSizePixel = 0
  215. Trans.Position = UDim2.new(0, 210, 0, 75)
  216. Trans.Size = UDim2.new(0, 90, 0, 15)
  217. Trans.Font = Enum.Font.Arcade
  218. Trans.FontSize = Enum.FontSize.Size14
  219. Trans.Text = "Transparency"
  220. Trans.TextSize = 14
  221.  
  222. Set.Name = "Set"
  223. Set.Parent = Frame
  224. Set.BackgroundColor3 = Color3.new(1, 1, 1)
  225. Set.BorderSizePixel = 0
  226. Set.Position = UDim2.new(0, 210, 0, 135)
  227. Set.Size = UDim2.new(0, 90, 0, 15)
  228. Set.Font = Enum.Font.Arcade
  229. Set.FontSize = Enum.FontSize.Size14
  230. Set.Text = "Set"
  231. Set.TextSize = 14
  232. Set.MouseButton1Down:connect(function()
  233. if Active == true then
  234. Active = false
  235. end
  236. BVal = tostring(BColor.Text)
  237. TVal = tonumber(Trans.Text)
  238. MVal = tostring(Material.Text)
  239. end)
  240.  
  241. BColor.Name = "BColor"
  242. BColor.Parent = Frame
  243. BColor.BackgroundColor3 = Color3.new(1, 1, 1)
  244. BColor.BorderSizePixel = 0
  245. BColor.Position = UDim2.new(0, 210, 0, 115)
  246. BColor.Size = UDim2.new(0, 90, 0, 15)
  247. BColor.Font = Enum.Font.Arcade
  248. BColor.FontSize = Enum.FontSize.Size14
  249. BColor.Text = "Lime Green"
  250. BColor.TextSize = 14
  251.  
  252. Random.Name = "Random"
  253. Random.Parent = Frame
  254. Random.BackgroundColor3 = Color3.new(1, 1, 1)
  255. Random.BorderSizePixel = 0
  256. Random.Position = UDim2.new(0, 10, 0, 80)
  257. Random.Size = UDim2.new(0, 90, 0, 30)
  258. Random.Font = Enum.Font.Arcade
  259. Random.FontSize = Enum.FontSize.Size14
  260. Random.Text = "Random"
  261. Random.TextSize = 14
  262. Random.MouseButton1Down:connect(function()
  263. if Active == false then
  264. Active = true
  265. end
  266. end)
  267.  
  268. Play.Name = "Play"
  269. Play.Parent = Frame
  270. Play.BackgroundColor3 = Color3.new(1, 1, 1)
  271. Play.BorderSizePixel = 0
  272. Play.Position = UDim2.new(0, 10, 0, 160)
  273. Play.Size = UDim2.new(0, 90, 0, 30)
  274. Play.Font = Enum.Font.Arcade
  275. Play.FontSize = Enum.FontSize.Size14
  276. Play.Text = "Play"
  277. Play.TextSize = 14
  278. Play.MouseButton1Down:connect(function()
  279. sound.TimePosition = 0
  280. sound.Playing = true
  281. sound.SoundId = "rbxassetid://"..tonumber(ID.Text)
  282. end)
  283.  
  284. Dark.Name = "Dark"
  285. Dark.Parent = Frame
  286. Dark.BackgroundColor3 = Color3.new(1, 1, 1)
  287. Dark.BorderSizePixel = 0
  288. Dark.Position = UDim2.new(0, 10, 0, 120)
  289. Dark.Size = UDim2.new(0, 90, 0, 30)
  290. Dark.Font = Enum.Font.Arcade
  291. Dark.FontSize = Enum.FontSize.Size14
  292. Dark.Text = "Dark"
  293. Dark.TextSize = 14
  294. Dark.MouseButton1Down:connect(function()
  295. game.Lighting.TimeOfDay = 0
  296. game.Lighting.GlobalShadows = false
  297. game.Lighting.Ambient = Color3.new(0,0,0)
  298. game.Lighting.Brightness = 0
  299. end)
  300.  
  301. Bright.Name = "Bright"
  302. Bright.Parent = Frame
  303. Bright.BackgroundColor3 = Color3.new(1, 1, 1)
  304. Bright.BorderSizePixel = 0
  305. Bright.Position = UDim2.new(0, 110, 0, 120)
  306. Bright.Size = UDim2.new(0, 90, 0, 30)
  307. Bright.Font = Enum.Font.Arcade
  308. Bright.FontSize = Enum.FontSize.Size14
  309. Bright.Text = "Bright"
  310. Bright.TextSize = 14
  311. Bright.MouseButton1Down:connect(function()
  312. game.Lighting.TimeOfDay = 12
  313. game.Lighting.GlobalShadows = true
  314. game.Lighting.Ambient = Color3.fromRGB(10,10,10)
  315. game.Lighting.Brightness = 1
  316. end)
  317.  
  318. Stop.Name = "Stop"
  319. Stop.Parent = Frame
  320. Stop.BackgroundColor3 = Color3.new(1, 1, 1)
  321. Stop.BorderSizePixel = 0
  322. Stop.Position = UDim2.new(0, 110, 0, 160)
  323. Stop.Size = UDim2.new(0, 90, 0, 30)
  324. Stop.Font = Enum.Font.Arcade
  325. Stop.FontSize = Enum.FontSize.Size14
  326. Stop.Text = "Stop"
  327. Stop.TextSize = 14
  328. Stop.MouseButton1Down:connect(function()
  329. sound.Playing = false
  330. end)
  331.  
  332. Hide.Name = "Hide"
  333. Hide.Parent = Frame
  334. Hide.BackgroundColor3 = Color3.new(1, 1, 1)
  335. Hide.BorderSizePixel = 0
  336. Hide.Position = UDim2.new(0, 210, 0, 160)
  337. Hide.Size = UDim2.new(0, 90, 0, 30)
  338. Hide.Font = Enum.Font.Arcade
  339. Hide.FontSize = Enum.FontSize.Size14
  340. Hide.Text = "Clear"
  341. Hide.TextSize = 14
  342. Hide.MouseButton1Down:connect(function()
  343. for i,v in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
  344. if v.Name == "location" then
  345. v:Remove()
  346. end
  347. end
  348. end)
  349.  
  350. --- Made By Pugz AKA (PugLover77)
  351. plyr = game.Players.LocalPlayer
  352. c = plyr.Character
  353. RunService = game:service'RunService'
  354. mouse = game.Players.LocalPlayer:GetMouse()
  355. local draw2 = false
  356. local colorA = 1
  357. local lastPos
  358.  
  359. tool = Instance.new("HopperBin", plyr.Backpack)
  360. tool.Name = "Draw"
  361.  
  362.  
  363.  
  364. mouse = plyr:GetMouse()
  365.  
  366.  
  367. function draw(obj) --
  368. local lastPos = obj.CFrame.p
  369. coroutine.wrap(function()
  370. while wait() do
  371. if draw2 then
  372. while draw2 do
  373. wait()
  374. objC = obj:Clone()
  375. objC.Parent = c
  376. objC.Anchored = true
  377. local distance = (lastPos- obj.CFrame.p).magnitude
  378. objC.Size = Vector3.new(.1,.1,distance)
  379. objC.CFrame = CFrame.new(lastPos,obj.Position)*CFrame.new(0,0,-distance/2)
  380. lastPos = obj.CFrame.p
  381. end
  382. else
  383. break
  384. end
  385. end
  386. end)()
  387. end
  388.  
  389. tool.Selected:connect(function(mouse)
  390.  
  391. mouse.Button1Down:connect(function(mouse)
  392. draw2 = true
  393. part = Instance.new("Part", c)
  394. mesh = Instance.new("BlockMesh",part)
  395. Li = Instance.new("PointLight",part)
  396. Li.Range = 8
  397. Li.Color = part.Color
  398. part.Name = "location"
  399.  
  400. part.BottomSurface = 0
  401. part.Material = MVal
  402. part.TopSurface = 0
  403. part.Size = Vector3.new()
  404. part.Transparency = TVal
  405. if Active == true then
  406. part.Color = Color3.new(math.random(), math.random(), math.random())
  407. elseif Active == false then
  408. part.BrickColor = BrickColor.new(BVal)
  409. end
  410. Li.Color = part.Color
  411. part.FormFactor = "Custom"
  412. part.Size = Vector3.new(0.01, 0.01, 0.01)
  413. part.Anchored = true
  414. part.Locked = true
  415. coroutine.wrap(function()
  416. while part ~= nil do
  417. part.CFrame = CFrame.new(plyr:GetMouse().Hit.p.x,plyr:GetMouse().Hit.p.y,plyr:GetMouse().Hit.p.z)
  418. wait()
  419. end
  420. end)()
  421. wait()
  422. draw(part)
  423. wait()
  424. end)
  425. mouse.Button1Up:connect(function(mouse)
  426. draw2 = false
  427.  
  428. end)
  429.  
  430. end)
  431. x = 60
  432. game:GetService("RunService").Stepped:connect(function()
  433. n = sound.PlaybackLoudness
  434. if n > 500 then
  435. x = 100
  436. elseif n < 500 then
  437. x = 110
  438. end
  439. for i,v in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
  440. if v.Name == "location" then
  441. v.Mesh.Scale = Vector3.new(n / x, n / x, n / x)
  442. v.PointLight.Range = n / 50
  443. end
  444. end
  445. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement