Advertisement
ManOhMan

Untitled

Jul 26th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- This script has been converted to FE by iPxter
  2.  
  3.  
  4. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  5. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  6. do
  7. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  8. script.Parent = Player.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent and t.Function then
  34. t.Function(...)
  35. end
  36. end
  37. m.TrigEvent = te
  38. UIS.TrigEvent = te
  39.  
  40. Event.OnServerEvent:Connect(function(plr,io)
  41. if plr~=Player then return end
  42. if io.isMouse then
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. else
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. for _,t in pairs(CAS.Actions) do
  51. for _,k in pairs(t.Keys) do
  52. if k==io.KeyCode then
  53. t.Function(t.Name,io.UserInputState,io)
  54. end
  55. end
  56. end
  57. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  58. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  59. end
  60. end)
  61. Event.Parent = NLS([==[
  62. local Player = game:GetService("Players").LocalPlayer
  63. local Event = script:WaitForChild("UserInput_Event")
  64.  
  65. local UIS = game:GetService("UserInputService")
  66. local input = function(io,a)
  67. if a then return end
  68. --Since InputObject is a client-side instance, we create and pass table instead
  69. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  70. end
  71. UIS.InputBegan:Connect(input)
  72. UIS.InputEnded:Connect(input)
  73.  
  74. local Mouse = Player:GetMouse()
  75. local h,t
  76. --Give the server mouse data 30 times every second, but only if the values changed
  77. --If player is not moving their mouse, client won't fire events
  78. while wait(1/30) do
  79. if h~=Mouse.Hit or t~=Mouse.Target then
  80. h,t=Mouse.Hit,Mouse.Target
  81. Event:FireServer({isMouse=true,Target=t,Hit=h})
  82. end
  83. end]==],Player.Character)
  84. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  85. end
  86. me = owner
  87. char = me.Character
  88. hold = false
  89. thickness = 0.1
  90. maxt = 10
  91. bricks = {}
  92.  
  93. color = BrickColor.new("Black")
  94. colors = {}
  95. for i=0,63,1 do
  96. table.insert(colors, BrickColor.palette(i))
  97. end
  98.  
  99. function checkt()
  100. if thickness < 0.1 then
  101. thickness = 0.1
  102. end
  103. if thickness > maxt then
  104. thickness = maxt
  105. end
  106. end
  107.  
  108. function makegui()
  109. local maxx = 200
  110. local x = 0
  111. local y = 0
  112. local g = Instance.new("ScreenGui")
  113. g.Name = "Colors"
  114. local fr = Instance.new("Frame",g)
  115. fr.Position = UDim2.new(0, 10, 0.3, 0)
  116. fr.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
  117. fr.BorderColor3 = Color3.new(0,0,0)
  118. local txt = nil
  119. local txt2 = nil
  120. local txt3 = nil
  121. for i,v in pairs(colors) do
  122. local gah = Instance.new("TextButton",fr)
  123. gah.Position = UDim2.new(0, x + 3, 0, y + 3)
  124. gah.Size = UDim2.new(0, 25, 0, 25)
  125. gah.BackgroundColor = v
  126. gah.BorderColor3 = Color3.new(0,0,0)
  127. gah.Text = ""
  128. gah.MouseButton1Down:connect(function()
  129. color = v
  130. txt.Text = v.Name
  131. end)
  132. gah.MouseEnter:connect(function()
  133. txt2.Text = v.Name
  134. end)
  135. gah.MouseLeave:connect(function() txt2.Text = ""
  136. end)
  137. x = x + 28
  138. if x >= maxx then
  139. x = 0
  140. y = y + 28
  141. end
  142. end
  143. fr.Size = UDim2.new(0, maxx + 27, 0, y + 40)
  144. txt = Instance.new("TextLabel",fr)
  145. txt.Size = UDim2.new(0.95, 0, 0, 35)
  146. txt.Position = UDim2.new(0.025, 0, 0, y + 3)
  147. txt.Text = color.Name
  148. txt.BackgroundColor3 = Color3.new(0.1, 0.1, 0.1)
  149. txt.BorderColor3 = Color3.new(0, 0, 0)
  150. txt.TextColor3 = Color3.new(1, 1, 1)
  151. txt.FontSize = "Size24"
  152. txt.Font = "ArialBold"
  153. txt.TextYAlignment = "Bottom"
  154. txt.TextXAlignment = "Left"
  155. txt2 = Instance.new("TextLabel",txt)
  156. txt2.Size = UDim2.new(1, 0, 0, 0)
  157. txt2.Text = color.Name
  158. txt2.BackgroundTransparency = 1
  159. txt2.TextColor3 = Color3.new(1, 1, 1)
  160. txt2.FontSize = "Size12"
  161. txt2.TextYAlignment = "Top"
  162. txt2.TextXAlignment = "Right"
  163. txt3 = Instance.new("TextLabel",fr)
  164. txt3.Size = UDim2.new(0.5, 0, 0, 25)
  165. txt3.Position = UDim2.new(0.25, 0, 1, 0)
  166. txt3.BackgroundColor3 = Color3.new(0.1, 0.1, 0.1)
  167. txt3.BorderColor3 = Color3.new(0,0,0)
  168. txt3.TextColor3 = Color3.new(1,1,1)
  169. txt3.FontSize = "Size12"
  170. txt3.Text = thickness
  171. g.Parent = me.PlayerGui
  172. coroutine.resume(coroutine.create(function()
  173. while g.Parent ~= nil do
  174. txt3.Text = thickness
  175. wait()
  176. end
  177. end))
  178. end
  179.  
  180. function remgui()
  181. for i,v in pairs(me.PlayerGui:children()) do
  182. if v.Name == "Colors" then v:remove() end
  183. end
  184. end
  185.  
  186. if script.Parent.className ~= "HopperBin" then
  187. h = Instance.new("HopperBin",me.Backpack)
  188. h.Name = "Draw"
  189. script.Parent = h
  190. end
  191.  
  192. bin = script.Parent
  193.  
  194. function weld(p1, p2)
  195. local w = Instance.new("Weld")
  196. w.Part0 = p2
  197. w.Part1 = p1
  198. w.C0 = p2.CFrame:toObjectSpace(p1.CFrame)
  199. w.Parent = p2
  200. end
  201.  
  202. function B1D(mouse)
  203. hold = true
  204. coroutine.resume(coroutine.create(function()
  205. mouse.Button1Up:wait()
  206. hold = false
  207. end))
  208. local p = Instance.new("Part",char)
  209. p.formFactor = "Custom"
  210. p.Size = Vector3.new(1,0.5,0.5)
  211. p.Anchored = true
  212. p.TopSurface = 0
  213. p.BottomSurface = 0
  214. p.CanCollide = false
  215. p.BrickColor = color
  216. p.Locked = true
  217. local m = Instance.new("BlockMesh",p)
  218. local targ = mouse.Target
  219. table.insert(bricks, p)
  220. local pos = mouse.Hit.p
  221. while hold do
  222. local mag = (pos - mouse.Hit.p).magnitude
  223. m.Scale = Vector3.new(thickness, 0.4, (mag+(thickness/3))*2)
  224. p.CFrame = CFrame.new(pos, mouse.Hit.p) * CFrame.new(0, 0, -mag/2 - thickness/5)
  225. if mag > thickness/2+0.1 then
  226. B1D(mouse)
  227. if targ ~= nil then
  228. if targ.Anchored == false then
  229. p.Anchored = false
  230. weld(p, targ)
  231. end
  232. end
  233. break
  234. end
  235. wait()
  236. end
  237. end
  238.  
  239. bin.Selected:connect(function(mouse)
  240. makegui()
  241. mouse.KeyDown:connect(function(key)
  242. key = key:lower()
  243. local kh = true
  244. coroutine.resume(coroutine.create(function()
  245. mouse.KeyUp:wait()
  246. kh = false
  247. end))
  248. if key == "q" then
  249. while kh do
  250. thickness = thickness - 0.1
  251. checkt()
  252. wait()
  253. end
  254. elseif key == "e" then
  255. while kh do
  256. thickness = thickness + 0.1
  257. checkt()
  258. wait()
  259. end
  260. elseif key == "z" then
  261. while kh do
  262. if #bricks > 0 then
  263. bricks[#bricks]:remove()
  264. table.remove(bricks, #bricks)
  265. end
  266. wait()
  267. end
  268. elseif key == "f" then
  269. for i = #bricks, 1, -1 do
  270. bricks[i]:remove()
  271. table.remove(bricks, i)
  272. end
  273. end
  274. end)
  275. mouse.Button1Down:connect(function()
  276. B1D(mouse)
  277. end)
  278. end)
  279.  
  280. bin.Deselected:connect(function()
  281. remgui()
  282. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement