Advertisement
3DCreator

fetchtarget

Dec 22nd, 2024
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. local players = game:GetService("Players")
  2.  
  3. return function(player, message)
  4.     if message == nil or message == "" or not message then
  5.         return {player}
  6.     elseif message:lower() == "me" then
  7.         return {player}
  8.     elseif message:lower() == "all" then
  9.         return players:GetPlayers()
  10.     elseif message:lower() == "others" then
  11.         local list = {}
  12.         for _, v in pairs(players:GetPlayers()) do
  13.             if v ~= player then
  14.                 table.insert(list, v)
  15.             end
  16.         end
  17.         return list
  18.     elseif message:lower() == "random" then
  19.         return {players:GetPlayers()[math.random(1, #players:GetPlayers())]}
  20.     else
  21.         for _, v in pairs(players:GetPlayers()) do
  22.             if v.Name:lower():sub(1, #message) == message:lower() then
  23.                 return {v}
  24.             end
  25.         end
  26.     end
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement