Advertisement
SeamedCargo

Untitled

Jul 3rd, 2015
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.15 KB | None | 0 0
  1. local done = false
  2.  
  3. function showHM(type,msg,parent,name)
  4. local M = Instance.new(type)
  5. M.Name = name
  6. M.Text = msg
  7. M.Parent = parent
  8. end
  9.  
  10. function noHM(parent,name)
  11. local M = parent:findFirstChild(name)
  12. if (M == nil) then return end
  13. M:remove()
  14. end
  15.  
  16. function addtoSource(source, text)
  17. source = (source ..text.. "\n")
  18. return source
  19. end
  20.  
  21. function getScript(call,caller)
  22. if (call == "get/DebugMessages") then
  23. S = Instance.new("Script")
  24. S.Name = "DebugMessages"
  25. S.Source = [[-- No Workspace Messages
  26. M = game.Workspace:GetChildren()
  27. for i=1, # M do
  28. if (M[i].className == "Message") or (M[i].className == "Hint") then
  29. M[i]:remove()
  30. end
  31. end
  32. -- No Player Messages
  33. P = game.Players:GetChildren()
  34. for i=1, # P do
  35. PM = P[i]:GetChildren()
  36. for i=1, # PM do
  37. if (PM[i].className == "Message") or (PM[i].className == "Hint") then
  38. PM[i]:remove()
  39. end
  40. end
  41. end ]]
  42. S.Parent = game.Workspace
  43. showHM("Message","No Messages!",speaker,"GetMsg")
  44. wait(0.8)
  45. noHM(caller,"GetMsg")
  46. end
  47. end
  48.  
  49. function onChatted(msg,recipient,speaker)
  50.  
  51. done = false
  52.  
  53. ---- Help Files
  54. if (msg == "help/") and (done == false) then
  55. done = true
  56. helpPlayer(speaker)
  57. end
  58. ----
  59.  
  60. ---- Get Commands
  61. if (msg == "get/DebugMessages") and (done == false) then
  62. done = true
  63. getScript("get/DebugMessages")
  64. end
  65. ----
  66.  
  67. ---- Script Builder Commands
  68. if (string.sub(msg,1,7) == "create/") and (done == false) then
  69. done = true
  70. local editing = speaker:findFirstChild("Editing")
  71. if (editing ~= nil) then return end
  72. script = game.Workspace:findFirstChild(string.sub(msg,8))
  73. if (script ~= nil) then
  74. if (script.className == "Script") then
  75. showHM("Hint","'"..string.sub(msg,8).."' has already been made.",speaker,"NO!")
  76. wait(0.8)
  77. noHM(speaker,"NO!")
  78. end
  79. end
  80. if (script == nil) then
  81. local S = Instance.new("Script")
  82. S.Source = ""
  83. S.Name = string.sub(msg,8)
  84. S.Disabled = true
  85. S.Parent = game.Workspace
  86. showHM("Message","'"..string.sub(msg,8).."' Created",speaker,"Created")
  87. wait(0.8)
  88. noHM(speaker,"Created")
  89. end
  90. end
  91.  
  92. if (string.sub(msg,1,5) == "edit/") and (done == false) then
  93. done = true
  94. local S = game.Workspace:findFirstChild(string.sub(msg,6))
  95. if (S ~= nil) then
  96. if (S.className == "Script") then
  97. local editnil = S:findFirstChild("Editing")
  98. if (editnil == nil) then
  99. local editing = speaker:findFirstChild("Editing")
  100. if (editing ~= nil) then return end
  101. local editing1 = Instance.new("StringValue")
  102. editing1.Name = "Editing"
  103. editing1.Value = speaker.Name
  104. editing1.Parent = S
  105. local editing2 = Instance.new("StringValue")
  106. editing2.Name = "Editing"
  107. editing2.Parent = speaker
  108. editing2.Value = S.Name
  109. showHM("Hint","Now in Edit Mode | Whatever you say shall be added to the script | say 'exit/' to exit",speaker,"EditMsg")
  110. else
  111. showHM("Hint",editnil.Value.. " is already editing it!",speaker,"NoEdit")
  112. wait(0.8)
  113. noHM(speaker,"NoEdit")
  114. end
  115. end
  116. end
  117. end
  118.  
  119. if (msg == "exit/") and (done == false) then
  120. done = true
  121. local editing1 = speaker:findFirstChild("Editing")
  122. if (editing1 == nil) then return end
  123. local S = game.Workspace:findFirstChild(editing1.Value)
  124. if (S ~= nil) then
  125. if (S.className == "Script") then
  126. local editing2 = S:findFirstChild("Editing")
  127. if (editing2 == nil) then return end
  128. editing1:remove()
  129. editing2:remove()
  130. noHM(speaker,"EditMsg")
  131. showHM("Hint","Stopped Editing '"..S.Name.."'",speaker,"Exit")
  132. wait(0.8)
  133. noHM(speaker,"Exit")
  134. end
  135. end
  136. end
  137.  
  138. if (string.sub(msg,1,4) == "run/") and (done == false) then
  139. done = true
  140. local S = game.Workspace:findFirstChild(string.sub(msg,5))
  141. if (S ~= nil) then
  142. if (S.className == "Script") then
  143. script = S:clone()
  144. script.Disabled = false
  145. script.Parent = game.Workspace
  146. S:remove()
  147. end
  148. end
  149. end
  150.  
  151. if (string.sub(msg,1,7) == "remove/") and (done == false) then
  152. done = true
  153. local S = game.Workspace:findFirstChild(string.sub(msg,8))
  154. if (S ~= nil) then
  155. if (S.className == "Script") then
  156. S:remove()
  157. showHM("Message","Removed '" ..S.Name.. "'",speaker,"Removal")
  158. wait(0.8)
  159. noHM(speaker,"Removal")
  160. end
  161. end
  162. end
  163. if (done == false) then -- Adding Code to Script
  164. done = true
  165. local editing1 = speaker:findFirstChild("Editing")
  166. if (editing1 == nil) then return end
  167. local S = game.Workspace:findFirstChild(editing1.Value)
  168. if (S ~= nil) then
  169. if (S.className == "Script") then
  170. local editing2 = S:findFirstChild("Editing")
  171. if (editing2 == nil) then return end
  172. S.Source = addtoSource(S.Source,msg)
  173. showHM("Message","Added",speaker,"Addition")
  174. wait(0.5)
  175. noHM(speaker,"Addition")
  176. end
  177. end
  178. end
  179. ----
  180.  
  181. end
  182.  
  183. ---- After Reset Connecting
  184. player = game.Players:GetChildren()
  185. for i=1, # player do
  186. player[i].Chatted:connect(function(msg,recipient) onChatted(msg,recipient,player[i]) end)
  187. end
  188. ----
  189.  
  190. function startPlayer(newPlayer)
  191. newPlayer.Chatted:connect(function(msg,recipient) onChatted(msg,recipient,newPlayer) end)
  192. end
  193.  
  194. game.Players.ChildAdded:connect(startPlayer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement