Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.08 KB | None | 0 0
  1. -- [[ VARIABLES ]] --
  2.  
  3. local serverStorage = game.ServerStorage
  4. local serverScriptService = game.ServerScriptService
  5. local signal = serverStorage.Commands[script.Parent.Name][script.Name]
  6. local library = require(serverScriptService.FunctionLibrary)
  7.  
  8.  
  9. -- [[ FUNCTIONS ]] --
  10.  
  11. -- On Signal
  12. function onSignal(player, input)
  13.     local character = player.Character
  14.     if #input > 0 then
  15.         input = table.concat(input, " ")
  16.         local endPunct = string.sub(input, #input, #input)
  17.         local getEnities = character.Parent:GetChildren()
  18.         for i = 1, #getEnities do
  19.             if getEnities[i] ~= character then
  20.                 local iPlayer = game.Players:GetPlayerFromCharacter(getEnities[i])
  21.                 if iPlayer then
  22.                         local message = library.FilterMessage(player, iPlayer, input)
  23.                     if endPunct == "?" then
  24.                         library.ConsoleMessage(iPlayer, "General", "SAY", character.ALIAS.Value..' asks, "'..message..'"')
  25.                     elseif endPunct == "!" then
  26.                         library.ConsoleMessage(iPlayer, "General", "SAY", character.ALIAS.Value..' exclaims, "'..message..'"')
  27.                     elseif string.sub(message, #message - 2) == "..." then
  28.                         library.ConsoleMessage(iPlayer, "General", "SAY", character.ALIAS.Value..' trails off, "'..message..'"')
  29.                     else
  30.                         library.ConsoleMessage(iPlayer, "General", "SAY", character.ALIAS.Value..' says, "'..message..'"')
  31.                     end
  32.                 end
  33.             else
  34.                 local message = library.FilterMessage(player, player, input)
  35.                 if endPunct == "?" then
  36.                     library.ConsoleMessage(player, "General", "DEFAULT", 'You ask, "'..message..'"')
  37.                 elseif endPunct == "!" then
  38.                     library.ConsoleMessage(player, "General", "DEFAULT", 'You exclaim, "'..message..'"')
  39.                 elseif string.sub(message, string.len(message) - 2) == "..." then
  40.                     library.ConsoleMessage(player, "General", "DEFAULT", 'You trail off, "'..message..'"')
  41.                 else
  42.                     library.ConsoleMessage(player, "General", "DEFAULT", 'You say, "'..message..'"')
  43.                 end
  44.             end
  45.         end
  46.     else
  47.         library.ConsoleMessage(player, "General", "ERROR", "You must include a message with the `say` command")
  48.     end
  49. end
  50.  
  51.  
  52. -- [[ CALLS ]] --
  53.  
  54. signal.Event:connect(onSignal)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement