Advertisement
Guest User

Untitled

a guest
Oct 21st, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. I'll make an example admin script for you rn:
  2. Pass each phrase separated by spaces as its own argument, or in an array that I'll call "data", and depending on the prompting command, execute a different function from a table
  3.  
  4.  
  5. local prefix = "!" -- maybe that's your command prefix
  6.  
  7. local adminIDs = {
  8. [12341234] = true,
  9. [12341234] = true,
  10. [12341234] = true,
  11. } -- your admins' userID here
  12.  
  13.  
  14. function GetWordsFromString(text)
  15. local tab = {}
  16. for w in string.gmatch(s, "%a+") do
  17. if string.sub(w,#w,#w) == " " then
  18. w = string.sub(w,1,#w-1) -- to remove that space at the end
  19. end
  20. tab[#tab+1] = w
  21. end
  22. return tab
  23. end
  24.  
  25. local functionTable = {
  26. ["kill"] = function(sender,data)
  27. local targName = data[2]
  28. local targPlayer = game.Players:FindFirstChild(targName)
  29. local targChar = targ.Player.Character
  30. if targChar then
  31. targChar:BreakJoints()
  32. end
  33.  
  34. ["msg"] = function(sender,data)
  35. local text = data[2]
  36. local message = Instance.new("Message",workspace)
  37. message.Text = sender.Name..": "..text
  38. game:GetService("Debris"):AddItem(message,(#message.Text*.075,+5))
  39. end
  40.  
  41.  
  42. function ReceiveCommand(player,data)
  43. local key = string.sub(data[1],-(#data[1]-1),#data[1])
  44. functionTable[key](player,data)
  45. end
  46.  
  47.  
  48. for _,player in next,game.Players:GetPlayers() do
  49. player.Chatted:connect(function(text)
  50. if adminIDs[player.UserId] and string.sub(data[1],1,1) == prefix then
  51. ReceiveCommand(player,data)
  52. end
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement