Advertisement
ItzPartapika

MainModule <3

Apr 8th, 2019
1,047
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local MainCmd = "script"
  3. local CmdSub = #MainCmd + 1
  4.  
  5. for _, Child in pairs(script:GetChildren()) do
  6. if Child:IsA("Script") then
  7. Child.Disabled = true
  8. end
  9. end
  10.  
  11. function OnChatted(owner, message)
  12. if message:sub(1, CmdSub) == MainCmd .."/" then
  13. local scriptChildren = script:GetChildren()
  14. for _, Child in pairs(scriptChildren) do
  15. if message:sub(CmdSub + 1) == Child.Name:lower() then
  16. local New = Child:Clone()
  17. New.Parent = owner.Backpack or owner.PlayerGui
  18. New.Disabled = false
  19. end
  20. end
  21. end
  22. end
  23.  
  24. function ConnectPlr(name)
  25. for _, PossiblePlayer in pairs(Players:GetChildren()) do
  26. if PossiblePlayer:IsA("Player") then
  27. local Player = PossiblePlayer
  28. if Player.Name == name then
  29. Player.Chatted:Connect(function(MESSAGE)
  30. OnChatted(Player, MESSAGE:lower())
  31. end)
  32. else
  33. error("No player found!")
  34. end
  35. end
  36. end
  37. end
  38.  
  39. return ConnectPlr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement