Advertisement
Dodikman

Command

Jul 5th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.14 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2.  
  3. local user_input = game:GetService('UserInputService')
  4.  
  5. local gui = Instance.new('ScreenGui')
  6. gui.Parent = plr.PlayerGui
  7. gui.ResetOnSpawn = false
  8.  
  9. local frame = Instance.new('Frame')
  10. frame.Style = Enum.FrameStyle.DropShadow
  11. frame.Size = UDim2.new(0.125, 0, 0.05, 0)
  12. frame.Position = UDim2.new(0, 0, 0.5, 0)
  13. frame.Parent = gui
  14.  
  15. local standard_text = 'Input command.'
  16. local input = Instance.new('TextBox')
  17. input.Size = UDim2.new(1, 0, 1, 0)
  18. input.BackgroundColor3 = Color3.new(0, 0, 0)
  19. input.BackgroundTransparency = 0.5
  20. input.TextColor3 = Color3.new(0, 255, 0)
  21. input.TextScaled = true
  22. input.Text = standard_text
  23. input.ClearTextOnFocus = false
  24. input.TextXAlignment = Enum.TextXAlignment.Left
  25. input.Font = Enum.Font.SourceSans
  26. input.Parent = frame
  27.  
  28. local working = false
  29. local stop = false
  30. function smooth_text(object, text, speed)
  31. if working == true then
  32. return
  33. end
  34. object.Text = ''
  35. working = true
  36. for i = 1, #text, 1 do
  37. if stop then
  38. break
  39. end
  40. object.Text = object.Text .. string.sub(text, i, i)
  41. wait(speed)
  42. end
  43. stop = false
  44. working = false
  45. end
  46.  
  47. local working_second = false
  48. local stop_second = false
  49. function smooth_clear(object, speed)
  50. if working_second == true then
  51. return
  52. end
  53. working_second = true
  54. local working_text = object.Text
  55. for i = #working_text, 0, -1 do
  56. if stop_second == true then
  57. break
  58. end
  59. object.Text = string.sub(working_text, 1, i)
  60. wait(speed)
  61. end
  62. stop_second = false
  63. working_second = false
  64. end
  65.  
  66. function get_first_argument(raw)
  67. if string.find(raw, ' ') then
  68. return string.sub(raw, 1, string.find(raw, ' ') - 1)
  69. else
  70. return nil
  71. end
  72. end
  73.  
  74. function get_arguments(raw, divider)
  75. local arguments = {}
  76. while get_first_argument(raw) ~= nil do
  77. arguments[#arguments + 1] = get_first_argument(raw)
  78. raw = string.sub(raw, string.find(raw, ' ') + 1)
  79. end
  80. arguments[#arguments + 1] = raw
  81. return arguments
  82. end
  83.  
  84. function valid(arguments, one)
  85. if arguments == nil then
  86. return false
  87. else
  88. if one == true then
  89. if #arguments > 1 then
  90. return false
  91. end
  92. end
  93. end
  94. return true
  95. end
  96.  
  97. local commands = {
  98. ['cmds'] = {
  99. ['additional'] = {'cmd', 'help'},
  100. ['description'] = 'Shows help.'
  101. },
  102. ['hipheight'] = {
  103. ['additional'] = {'hh'},
  104. ['description'] = 'Changes your hipheight.'
  105. },
  106. ['gaf'] = {
  107. ['game'] = 'steve\'s one piece',
  108. ['additional'] = {'gaf'},
  109. ['description'] = 'Teleports all tools to you.'
  110. },
  111. ['print'] = {
  112. ['description'] = 'Prints your arguments.'
  113. },
  114. ['walkspeed'] = {
  115. ['additional'] = {'ws', 'speed'},
  116. ['description'] = 'Changes your walkspeed.'
  117. }
  118. }
  119.  
  120. local current = 0
  121. local frame = Instance.new('ScrollingFrame')
  122. frame.Visible = false
  123. frame.Size = UDim2.new(0.4, 0, 0.4, 0)
  124. frame.Position = UDim2.new(0.13, 0, 0.5, 0)
  125. frame.BackgroundColor3 = Color3.new(0, 0, 0)
  126. frame.BackgroundTransparency = 0.5
  127. frame.Parent = gui
  128.  
  129. for k, v in pairs(commands) do
  130. local text_label = Instance.new('TextLabel')
  131. text_label.Size = UDim2.new(0.25, 0, 0.025, 0)
  132. text_label.Position = UDim2.new(0, 0, current)
  133. text_label.BackgroundColor3 = Color3.new(0, 0, 0)
  134. text_label.BackgroundTransparency = 0.5
  135. text_label.TextColor3 = Color3.new(0, 255, 0)
  136. text_label.TextScaled = true
  137. text_label.Text = k
  138. text_label.Font = Enum.Font.SourceSans
  139. text_label.Parent = frame
  140. local text_description = text_label:Clone()
  141. text_description.Text = v['description']
  142. text_description.Size = text_description.Size + UDim2.new(0.5, 0, 0, 0)
  143. text_description.Position = text_description.Position + UDim2.new(0.25, 0, 0, 0)
  144. text_description.Parent = frame
  145. current = current + 0.026
  146. end
  147.  
  148. local close = Instance.new('TextButton')
  149. close.Visible = false
  150. close.Size = UDim2.new(0.03, 0, 0.03, 0)
  151. close.Position = UDim2.new(0.54, 0, 0.5, 0)
  152. close.BackgroundColor3 = Color3.new(255, 0, 0)
  153. close.BackgroundTransparency = 0.5
  154. close.Text = 'X'
  155. close.TextColor3 = Color3.new(255, 255, 255)
  156. close.TextScaled = true
  157. close.Parent = gui
  158.  
  159. close.MouseButton1Click:Connect(function()
  160. frame.Visible = false
  161. close.Visible = false
  162. end)
  163.  
  164. local showed = false
  165.  
  166. function show_help()
  167. if frame.Visible == false then
  168. close.Visible = true
  169. frame.Visible = true
  170. else
  171. close.Visible = false
  172. frame.Visible = false
  173. end
  174. end
  175.  
  176. function process_command(raw)
  177. local raw = string.lower(raw)
  178. local arguments = get_arguments(raw, ' ')
  179. local command = nil
  180. if arguments ~= nil then
  181. command = arguments[1]
  182. table.remove(arguments, 1)
  183. else
  184. command = raw
  185. end
  186. if command == 'cmds' or command == 'cmd' or command == 'help' then
  187. show_help()
  188. end
  189. if command == 'print' then
  190. local to_print = table.concat(arguments, ' ')
  191. print(to_print)
  192. end
  193. if command == 'hipheight' or command == 'hh' then
  194. if valid(arguments, true) then
  195. if game.Workspace:FindFirstChild(plr.Name) then
  196. plr.Character.Humanoid.HipHeight = tonumber(arguments[1])
  197. end
  198. end
  199. end
  200. if command == 'walkspeed' or command == 'ws' then
  201. if valid(arguments, true) then
  202. if game.Workspace:FindFirstChild(plr.Name) then
  203. plr.Character.Humanoid.WalkSpeed = tonumber(arguments[1])
  204. end
  205. end
  206. end
  207. if command == 'getallfruits' or command == 'gaf' then
  208. for _, v in pairs(game.Workspace:GetChildren()) do
  209. if v.ClassName == 'Tool' then
  210. if v:FindFirstChild('Handle') then
  211. local m = Instance.new('Model')
  212. m.Parent = game.Workspace
  213. v.Parent = m
  214. m:MoveTo(plr.Character.Head.Position)
  215. end
  216. end
  217. end
  218. end
  219. end
  220.  
  221. input.Focused:Connect(function()
  222. if working == true then
  223. stop = true
  224. smooth_clear(input, 0.001)
  225. else
  226. smooth_clear(input, 0.001)
  227. end
  228. end)
  229.  
  230. input.FocusLost:Connect(function()
  231. smooth_text(input, standard_text, 0.001)
  232. end)
  233.  
  234. user_input.InputBegan:Connect(function(input_object)
  235. if input_object.KeyCode == Enum.KeyCode.Semicolon then
  236. if input:IsFocused() then
  237. if input.Text ~= standard_text then
  238. if input.Text ~= nil then
  239. process_command(input.Text)
  240. end
  241. input:ReleaseFocus()
  242. end
  243. else
  244. input:CaptureFocus()
  245. end
  246. else
  247. if working_second == true then
  248. input.Text = ''
  249. stop_second = true
  250. end
  251. end
  252. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement