Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local done = false
- function showHM(type,msg,parent,name)
- local M = Instance.new(type)
- M.Name = name
- M.Text = msg
- M.Parent = parent
- end
- function noHM(parent,name)
- local M = parent:findFirstChild(name)
- if (M == nil) then return end
- M:remove()
- end
- function addtoSource(source, text)
- source = (source ..text.. "\n")
- return source
- end
- function getScript(call,caller)
- if (call == "get/DebugMessages") then
- S = Instance.new("Script")
- S.Name = "DebugMessages"
- S.Source = [[-- No Workspace Messages
- M = game.Workspace:GetChildren()
- for i=1, # M do
- if (M[i].className == "Message") or (M[i].className == "Hint") then
- M[i]:remove()
- end
- end
- -- No Player Messages
- P = game.Players:GetChildren()
- for i=1, # P do
- PM = P[i]:GetChildren()
- for i=1, # PM do
- if (PM[i].className == "Message") or (PM[i].className == "Hint") then
- PM[i]:remove()
- end
- end
- end ]]
- S.Parent = game.Workspace
- showHM("Message","No Messages!",speaker,"GetMsg")
- wait(0.8)
- noHM(caller,"GetMsg")
- end
- end
- function onChatted(msg,recipient,speaker)
- done = false
- ---- Help Files
- if (msg == "help/") and (done == false) then
- done = true
- helpPlayer(speaker)
- end
- ----
- ---- Get Commands
- if (msg == "get/DebugMessages") and (done == false) then
- done = true
- getScript("get/DebugMessages")
- end
- ----
- ---- Script Builder Commands
- if (string.sub(msg,1,7) == "create/") and (done == false) then
- done = true
- local editing = speaker:findFirstChild("Editing")
- if (editing ~= nil) then return end
- script = game.Workspace:findFirstChild(string.sub(msg,8))
- if (script ~= nil) then
- if (script.className == "Script") then
- showHM("Hint","'"..string.sub(msg,8).."' has already been made.",speaker,"NO!")
- wait(0.8)
- noHM(speaker,"NO!")
- end
- end
- if (script == nil) then
- local S = Instance.new("Script")
- S.Source = ""
- S.Name = string.sub(msg,8)
- S.Disabled = true
- S.Parent = game.Workspace
- showHM("Message","'"..string.sub(msg,8).."' Created",speaker,"Created")
- wait(0.8)
- noHM(speaker,"Created")
- end
- end
- if (string.sub(msg,1,5) == "edit/") and (done == false) then
- done = true
- local S = game.Workspace:findFirstChild(string.sub(msg,6))
- if (S ~= nil) then
- if (S.className == "Script") then
- local editnil = S:findFirstChild("Editing")
- if (editnil == nil) then
- local editing = speaker:findFirstChild("Editing")
- if (editing ~= nil) then return end
- local editing1 = Instance.new("StringValue")
- editing1.Name = "Editing"
- editing1.Value = speaker.Name
- editing1.Parent = S
- local editing2 = Instance.new("StringValue")
- editing2.Name = "Editing"
- editing2.Parent = speaker
- editing2.Value = S.Name
- showHM("Hint","Now in Edit Mode | Whatever you say shall be added to the script | say 'exit/' to exit",speaker,"EditMsg")
- else
- showHM("Hint",editnil.Value.. " is already editing it!",speaker,"NoEdit")
- wait(0.8)
- noHM(speaker,"NoEdit")
- end
- end
- end
- end
- if (msg == "exit/") and (done == false) then
- done = true
- local editing1 = speaker:findFirstChild("Editing")
- if (editing1 == nil) then return end
- local S = game.Workspace:findFirstChild(editing1.Value)
- if (S ~= nil) then
- if (S.className == "Script") then
- local editing2 = S:findFirstChild("Editing")
- if (editing2 == nil) then return end
- editing1:remove()
- editing2:remove()
- noHM(speaker,"EditMsg")
- showHM("Hint","Stopped Editing '"..S.Name.."'",speaker,"Exit")
- wait(0.8)
- noHM(speaker,"Exit")
- end
- end
- end
- if (string.sub(msg,1,4) == "run/") and (done == false) then
- done = true
- local S = game.Workspace:findFirstChild(string.sub(msg,5))
- if (S ~= nil) then
- if (S.className == "Script") then
- script = S:clone()
- script.Disabled = false
- script.Parent = game.Workspace
- S:remove()
- end
- end
- end
- if (string.sub(msg,1,7) == "remove/") and (done == false) then
- done = true
- local S = game.Workspace:findFirstChild(string.sub(msg,8))
- if (S ~= nil) then
- if (S.className == "Script") then
- S:remove()
- showHM("Message","Removed '" ..S.Name.. "'",speaker,"Removal")
- wait(0.8)
- noHM(speaker,"Removal")
- end
- end
- end
- if (done == false) then -- Adding Code to Script
- done = true
- local editing1 = speaker:findFirstChild("Editing")
- if (editing1 == nil) then return end
- local S = game.Workspace:findFirstChild(editing1.Value)
- if (S ~= nil) then
- if (S.className == "Script") then
- local editing2 = S:findFirstChild("Editing")
- if (editing2 == nil) then return end
- S.Source = addtoSource(S.Source,msg)
- showHM("Message","Added",speaker,"Addition")
- wait(0.5)
- noHM(speaker,"Addition")
- end
- end
- end
- ----
- end
- ---- After Reset Connecting
- player = game.Players:GetChildren()
- for i=1, # player do
- player[i].Chatted:connect(function(msg,recipient) onChatted(msg,recipient,player[i]) end)
- end
- ----
- function startPlayer(newPlayer)
- newPlayer.Chatted:connect(function(msg,recipient) onChatted(msg,recipient,newPlayer) end)
- end
- game.Players.ChildAdded:connect(startPlayer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement