sagat1719

fileditor

Apr 15th, 2024
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.95 KB | None | 0 0
  1. -- Gui to Lua
  2. -- Version: 3.2
  3.  
  4. -- Instances:
  5.  
  6. fileditor = Instance.new("ScreenGui")
  7. editor = Instance.new("Frame")
  8. Title = Instance.new("TextLabel")
  9. content = Instance.new("TextBox")
  10. X = Instance.new("TextButton")
  11. down = Instance.new("Frame")
  12. save = Instance.new("TextButton")
  13. execute = Instance.new("TextButton")
  14. Clear = Instance.new("TextButton")
  15. Choose = Instance.new("Frame")
  16. YesNo = Instance.new("Frame")
  17. Title_2 = Instance.new("TextLabel")
  18. No = Instance.new("TextButton")
  19. Yes = Instance.new("TextButton")
  20. X_2 = Instance.new("TextButton")
  21. textbox = Instance.new("Frame")
  22. Title_3 = Instance.new("TextLabel")
  23. name = Instance.new("TextBox")
  24. OK = Instance.new("TextButton")
  25. X_3 = Instance.new("TextButton")
  26. Minimize = Instance.new("TextButton")
  27.  
  28. --Properties:
  29.  
  30. fileditor.Name = "fileditor"
  31. fileditor.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  32. fileditor.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  33. fileditor.ResetOnSpawn = false
  34.  
  35. editor.Name = "editor"
  36. editor.Parent = fileditor
  37. editor.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  38. editor.BorderColor3 = Color3.fromRGB(0, 200, 0)
  39. editor.BorderSizePixel = 2
  40. editor.Position = UDim2.new(0.20198676, 0, 0.0936599448, 0)
  41. editor.Size = UDim2.new(0, 700, 0, 30)
  42.  
  43. Title.Name = "Title"
  44. Title.Parent = editor
  45. Title.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  46. Title.BackgroundTransparency = 1.000
  47. Title.BorderColor3 = Color3.fromRGB(0, 0, 0)
  48. Title.BorderSizePixel = 0
  49. Title.Size = UDim2.new(0.122857146, 0, 1, 0)
  50. Title.Font = Enum.Font.Arial
  51. Title.Text = " File Editor"
  52. Title.TextColor3 = Color3.fromRGB(0, 200, 0)
  53. Title.TextSize = 14.000
  54. Title.TextXAlignment = Enum.TextXAlignment.Left
  55.  
  56. content.Name = "content"
  57. content.Parent = editor
  58. content.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  59. content.BorderColor3 = Color3.fromRGB(0, 200, 0)
  60. content.BorderSizePixel = 2
  61. content.Position = UDim2.new(0, 0, 0, 30)
  62. content.Size = UDim2.new(0, 700, 0, 270)
  63. content.ClearTextOnFocus = false
  64. content.Font = Enum.Font.SourceSans
  65. content.MultiLine = true
  66. content.PlaceholderColor3 = Color3.fromRGB(0, 100, 0)
  67. content.PlaceholderText = "Type here any content of file you need."
  68. content.Text = ""
  69. content.TextColor3 = Color3.fromRGB(0, 200, 0)
  70. content.TextSize = 14.000
  71. content.TextXAlignment = Enum.TextXAlignment.Left
  72. content.TextYAlignment = Enum.TextYAlignment.Top
  73.  
  74. X.Name = "X"
  75. X.Parent = editor
  76. X.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  77. X.BorderColor3 = Color3.fromRGB(0, 200, 0)
  78. X.BorderSizePixel = 2
  79. X.Position = UDim2.new(0, 673, 0, 0)
  80. X.Size = UDim2.new(0, 27, 0, 27)
  81. X.Font = Enum.Font.SourceSans
  82. X.Text = "X"
  83. X.TextColor3 = Color3.fromRGB(0, 200, 0)
  84. X.TextScaled = true
  85. X.TextSize = 14.000
  86. X.TextWrapped = true
  87.  
  88. down.Name = "down"
  89. down.Parent = editor
  90. down.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  91. down.BorderColor3 = Color3.fromRGB(0, 200, 0)
  92. down.BorderSizePixel = 2
  93. down.Position = UDim2.new(0, 0, 0, 300)
  94. down.Size = UDim2.new(0, 700, 0, 30)
  95. down.ZIndex = 5
  96.  
  97. Minimize.Name = "Minimize"
  98. Minimize.Parent = fileditor
  99. Minimize.BackgroundColor3 = Color3.new(0.5,0.5,0.5)
  100. Minimize.BackgroundTransparency = 0.500
  101. Minimize.BorderSizePixel = 0
  102. Minimize.Position = UDim2.new(0.6, 0, 0.2, 0)
  103. Minimize.Size = UDim2.new(0, 100, 0, 100)
  104. Minimize.Visible = false
  105. Minimize.AutoButtonColor = false
  106. Minimize.Font = Enum.Font.Arial
  107. Minimize.Text = "+"
  108. Minimize.TextColor3 = Color3.fromRGB(0, 0, 0)
  109. Minimize.TextScaled = true
  110. Minimize.TextSize = 14
  111.  
  112. save.Name = "save"
  113. save.Parent = down
  114. save.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  115. save.BorderColor3 = Color3.fromRGB(0, 200, 0)
  116. save.BorderSizePixel = 2
  117. save.Position = UDim2.new(0, 580, 0, 0)
  118. save.Size = UDim2.new(0, 120, 0, 30)
  119. save.Font = Enum.Font.SourceSans
  120. save.Text = "Save as File"
  121. save.TextColor3 = Color3.fromRGB(0, 200, 0)
  122. save.TextSize = 24.000
  123. save.TextWrapped = true
  124.  
  125. execute.Name = "execute"
  126. execute.Parent = down
  127. execute.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  128. execute.BorderColor3 = Color3.fromRGB(0, 200, 0)
  129. execute.BorderSizePixel = 2
  130. execute.Size = UDim2.new(0, 120, 0, 30)
  131. execute.Font = Enum.Font.SourceSans
  132. execute.Text = "Execute"
  133. execute.TextColor3 = Color3.fromRGB(0, 200, 0)
  134. execute.TextSize = 24.000
  135. execute.TextWrapped = true
  136.  
  137. Clear.Name = "Clear"
  138. Clear.Parent = down
  139. Clear.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  140. Clear.BorderColor3 = Color3.fromRGB(0, 200, 0)
  141. Clear.BorderSizePixel = 2
  142. Clear.Position = UDim2.new(0.171428576, 0, 0, 0)
  143. Clear.Size = UDim2.new(0, 120, 0, 30)
  144. Clear.Font = Enum.Font.SourceSans
  145. Clear.Text = "Clear"
  146. Clear.TextColor3 = Color3.fromRGB(0, 200, 0)
  147. Clear.TextSize = 24.000
  148. Clear.TextWrapped = true
  149.  
  150. Choose.Name = "Choose"
  151. Choose.Parent = fileditor
  152. Choose.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  153. Choose.BackgroundTransparency = 0.500
  154. Choose.BorderColor3 = Color3.fromRGB(0, 0, 0)
  155. Choose.BorderSizePixel = 0
  156. Choose.Size = UDim2.new(1, 0, 1, 0)
  157. Choose.Visible = false
  158. Choose.ZIndex = 50
  159.  
  160. YesNo.Name = "YesNo"
  161. YesNo.Parent = Choose
  162. YesNo.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  163. YesNo.BorderColor3 = Color3.fromRGB(0, 200, 0)
  164. YesNo.BorderSizePixel = 2
  165. YesNo.Position = UDim2.new(0.5, -150, 0.5, -70)
  166. YesNo.Size = UDim2.new(0, 300, 0, 140)
  167. YesNo.Visible = false
  168. YesNo.ZIndex = 5
  169.  
  170. Title_2.Name = "Title"
  171. Title_2.Parent = YesNo
  172. Title_2.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  173. Title_2.BorderColor3 = Color3.fromRGB(0, 200, 0)
  174. Title_2.BorderSizePixel = 2
  175. Title_2.Position = UDim2.new(-0.00333333341, 0, 0, 0)
  176. Title_2.Size = UDim2.new(1, 0, 0, 24)
  177. Title_2.Font = Enum.Font.Arial
  178. Title_2.Text = " Are you sure?"
  179. Title_2.TextColor3 = Color3.fromRGB(0, 200, 0)
  180. Title_2.TextSize = 18.000
  181. Title_2.TextXAlignment = Enum.TextXAlignment.Left
  182.  
  183. No.Name = "No"
  184. No.Parent = YesNo
  185. No.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  186. No.BorderColor3 = Color3.fromRGB(0, 200, 0)
  187. No.BorderSizePixel = 2
  188. No.Position = UDim2.new(0.591666639, 0, 0.4738096, 0)
  189. No.Size = UDim2.new(0, 50, 0, 24)
  190. No.Font = Enum.Font.SourceSans
  191. No.Text = "No"
  192. No.TextColor3 = Color3.fromRGB(0, 200, 0)
  193. No.TextSize = 18.000
  194. No.TextWrapped = true
  195.  
  196. Yes.Name = "Yes"
  197. Yes.Parent = YesNo
  198. Yes.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  199. Yes.BorderColor3 = Color3.fromRGB(0, 200, 0)
  200. Yes.BorderSizePixel = 2
  201. Yes.Position = UDim2.new(0.24166666, 0, 0.4738096, 0)
  202. Yes.Size = UDim2.new(0, 50, 0, 24)
  203. Yes.Font = Enum.Font.SourceSans
  204. Yes.Text = "Yes"
  205. Yes.TextColor3 = Color3.fromRGB(0, 200, 0)
  206. Yes.TextSize = 18.000
  207. Yes.TextWrapped = true
  208.  
  209. X_2.Name = "X"
  210. X_2.Parent = YesNo
  211. X_2.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  212. X_2.BorderColor3 = Color3.fromRGB(0, 200, 0)
  213. X_2.BorderSizePixel = 2
  214. X_2.Position = UDim2.new(0, 276, 0, 0)
  215. X_2.Size = UDim2.new(0, 24, 0, 24)
  216. X_2.Font = Enum.Font.SourceSans
  217. X_2.Text = "X"
  218. X_2.TextColor3 = Color3.fromRGB(0, 200, 0)
  219. X_2.TextScaled = true
  220. X_2.TextSize = 14.000
  221. X_2.TextWrapped = true
  222.  
  223. textbox.Name = "textbox"
  224. textbox.Parent = Choose
  225. textbox.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  226. textbox.BorderColor3 = Color3.fromRGB(0, 200, 0)
  227. textbox.BorderSizePixel = 2
  228. textbox.Position = UDim2.new(0.5, -120, 0.5, -90)
  229. textbox.Size = UDim2.new(0, 240, 0, 180)
  230. textbox.ZIndex = 5
  231.  
  232. Title_3.Name = "Title"
  233. Title_3.Parent = textbox
  234. Title_3.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  235. Title_3.BorderColor3 = Color3.fromRGB(0, 200, 0)
  236. Title_3.BorderSizePixel = 2
  237. Title_3.Size = UDim2.new(1, 0, 0, 24)
  238. Title_3.Font = Enum.Font.Arial
  239. Title_3.Text = " Type here a file name"
  240. Title_3.TextColor3 = Color3.fromRGB(0, 200, 0)
  241. Title_3.TextSize = 18.000
  242. Title_3.TextXAlignment = Enum.TextXAlignment.Left
  243.  
  244. name.Name = "name"
  245. name.Parent = textbox
  246. name.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  247. name.BorderColor3 = Color3.fromRGB(0, 200, 0)
  248. name.BorderSizePixel = 2
  249. name.Position = UDim2.new(-0.416666657, 110, 0.50555557, 0)
  250. name.Size = UDim2.new(0, 220, 0, 24)
  251. name.Font = Enum.Font.Arial
  252. name.PlaceholderColor3 = Color3.fromRGB(0, 100, 0)
  253. name.PlaceholderText = "Text here"
  254. name.Text = ""
  255. name.TextColor3 = Color3.fromRGB(0, 200, 0)
  256. name.TextSize = 14.000
  257.  
  258. OK.Name = "OK"
  259. OK.Parent = textbox
  260. OK.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  261. OK.BorderColor3 = Color3.fromRGB(0, 200, 0)
  262. OK.BorderSizePixel = 2
  263. OK.Position = UDim2.new(0.791666687, 0, 0.866666675, 0)
  264. OK.Size = UDim2.new(0, 50, 0, 24)
  265. OK.Font = Enum.Font.SourceSans
  266. OK.Text = "OK"
  267. OK.TextColor3 = Color3.fromRGB(0, 200, 0)
  268. OK.TextSize = 18.000
  269. OK.TextWrapped = true
  270.  
  271. X_3.Name = "X"
  272. X_3.Parent = textbox
  273. X_3.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  274. X_3.BorderColor3 = Color3.fromRGB(0, 200, 0)
  275. X_3.BorderSizePixel = 2
  276. X_3.Position = UDim2.new(0, 216, 0, 0)
  277. X_3.Size = UDim2.new(0, 24, 0, 24)
  278. X_3.Font = Enum.Font.SourceSans
  279. X_3.Text = "X"
  280. X_3.TextColor3 = Color3.fromRGB(0, 200, 0)
  281. X_3.TextScaled = true
  282. X_3.TextSize = 14.000
  283. X_3.TextWrapped = true
  284.  
  285. X.MouseButton1Click:Connect(function()
  286. editor.Visible = false
  287. Minimize.Visible = true
  288. end)
  289.  
  290. Minimize.MouseButton1Click:Connect(function()
  291. editor.Visible = true
  292. Minimize.Visible = false
  293. end)
  294.  
  295. local UserInputService = game:GetService("UserInputService")
  296.  
  297. local gui = Minimize
  298.  
  299. local dragging
  300. local dragInput
  301. local dragStart
  302. local startPos
  303.  
  304. local function update(input)
  305. local delta = input.Position - dragStart
  306. gui.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  307. end
  308.  
  309. gui.InputBegan:Connect(function(input)
  310. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  311. dragging = true
  312. dragStart = input.Position
  313. startPos = gui.Position
  314.  
  315. input.Changed:Connect(function()
  316. if input.UserInputState == Enum.UserInputState.End then
  317. game:GetService("GuiService").TouchControlsEnabled = true
  318. dragging = false
  319. end
  320. end)
  321. end
  322. end)
  323.  
  324. gui.InputChanged:Connect(function(input)
  325. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  326. game:GetService("GuiService").TouchControlsEnabled = false
  327. dragInput = input
  328. end
  329. end)
  330.  
  331. UserInputService.InputChanged:Connect(function(input)
  332. if input == dragInput and dragging then
  333. update(input)
  334. end
  335. end)
  336.  
  337. local gui = editor
  338.  
  339. local dragging
  340. local dragInput
  341. local dragStart
  342. local startPos
  343.  
  344. local function update(input)
  345. local delta = input.Position - dragStart
  346. gui.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  347. end
  348.  
  349. gui.InputBegan:Connect(function(input)
  350. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  351. dragging = true
  352. dragStart = input.Position
  353. startPos = gui.Position
  354.  
  355. input.Changed:Connect(function()
  356. if input.UserInputState == Enum.UserInputState.End then
  357. game:GetService("GuiService").TouchControlsEnabled = true
  358. dragging = false
  359. end
  360. end)
  361. end
  362. end)
  363.  
  364. gui.InputChanged:Connect(function(input)
  365. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  366. game:GetService("GuiService").TouchControlsEnabled = false
  367. dragInput = input
  368. end
  369. end)
  370.  
  371. UserInputService.InputChanged:Connect(function(input)
  372. if input == dragInput and dragging then
  373. update(input)
  374. end
  375. end)
  376.  
  377. local function savefile()
  378. Choose.Visible=true
  379. name.Text = ""
  380. YesNo.Visible = false
  381. textbox.Visible = true
  382. OK.MouseButton1Click:Connect(function()
  383. if name.Text == "" then
  384. warn("No file name!")
  385. else
  386. textbox.Visible = false
  387. YesNo.Visible = true
  388. end
  389. end)
  390. end
  391.  
  392. X_2.MouseButton1Click:Connect(function()
  393. Choose.Visible = false
  394. end)
  395.  
  396. X_3.MouseButton1Click:Connect(function()
  397. Choose.Visible = false
  398. end)
  399. save.MouseButton1Click:Connect(savefile)
  400.  
  401. Yes.MouseButton1Click:Connect(function()
  402. writefile(name.Text, content.Text)
  403. Choose.Visible = false
  404. end)
  405.  
  406. No.MouseButton1Click:Connect(function()
  407. Choose.Visible = false
  408. end)
  409.  
  410. execute.MouseButton1Click:Connect(function()
  411. loadstring(content.Text)()
  412. end)
  413.  
  414. Clear.MouseButton1Click:Connect(function()
  415. content.Text = ""
  416. end)
Advertisement
Add Comment
Please, Sign In to add comment