Advertisement
xxPH4NTOM

Untitled

Jun 22nd, 2020
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.28 KB | None | 0 0
  1. --// Fake Friend Joined Notifier Script //--
  2.     -- This Script is EXTREMELY FUN to Troll with XD.
  3.     -- It looks just like the regular system message
  4.     -- so most people fall for it XD
  5. --// _____Made by NoahNation#5582_____ //--
  6.  
  7. --// Settings (You May Edit) //--
  8.  
  9. times = _G.times or 1 -- How many times to send the notification message per player.
  10. botMode = _G.botMode or false -- If this is set to true, it will leave the game after sending all the notifications, then it will rejoin. (NOTE: YOU MUST HAVE THIS SCRIPT OR A COPY OF THIS SCRIPT IN THE 'AUTOEXEC' FOLDER OF SYNAPSE FOR THIS SETTING TO WORK.)
  11. customName = _G.customName or '' -- A custom name to use. If you want to use a random friend from their friends list, leave this blank.
  12.  
  13. --// Do Not Edit Below //--
  14. local percentComplete = 0
  15. local finished = false
  16. local h = Instance.new('Hint',workspace)
  17. game:GetService('RunService').RenderStepped:Connect(function()
  18.     if not finished then
  19.         percentComplete = ((_G.timesCompleted/_G.timesLeft)*100)
  20.         wait()
  21.         percentComplete = tostring(percentComplete)
  22.         wait()
  23.         h.Text = tostring(percentComplete)..'% Complete'
  24.         if ((_G.timesCompleted/_G.timesLeft)*100) == 100 then
  25.             finished = true
  26.             h.Text = 'Done!'
  27.             wait(3)
  28.             h:Remove()
  29.         end
  30.     end
  31. end)
  32.  
  33. if game.PlaceId == 4693806589 then
  34.     game:GetService("TeleportService"):Teleport(3694166020)
  35. end
  36.  
  37. if game.PlaceId ~= 4693806589 then
  38.     for i = 1,times do
  39.         _G.timesCompleted = i
  40.         _G.timesLeft = times
  41.         local plrs = game:GetService('Players')
  42.  
  43.         function getFriends(player)
  44.             local Players = game:GetService("Players")
  45.            
  46.             local USERNAME = player.Name
  47.        
  48.             local function iterPageItems(pages)
  49.                 return coroutine.wrap(function()
  50.                     local pagenum = 1
  51.                     while true do
  52.                         for _, item in ipairs(pages:GetCurrentPage()) do
  53.                             coroutine.yield(item, pagenum)
  54.                         end
  55.                         if pages.IsFinished then
  56.                             break
  57.                         end
  58.                         pages:AdvanceToNextPageAsync()
  59.                         pagenum = pagenum + 1
  60.                     end
  61.                 end)
  62.             end
  63.            
  64.             -- First, get the user ID of the player
  65.             local userId = Players:GetUserIdFromNameAsync(USERNAME)
  66.             -- Then, get a FriendPages object for their friends
  67.             local friendPages = Players:GetFriendsAsync(userId)
  68.             -- Iterate over the items in the pages. For FriendPages, these
  69.             -- are tables of information about the friend, including Username.
  70.             -- Collect each username in a table
  71.             local usernames = {}
  72.             for item, pageNo in iterPageItems(friendPages) do
  73.                 table.insert(usernames, item.Username)
  74.             end
  75.             wait()
  76.             return usernames
  77.         end
  78.  
  79.         for i,v in pairs(plrs:GetPlayers()) do
  80.             if v~= game.Players.LocalPlayer then
  81.                 local friends = getFriends(v)
  82.                 if #friends > 0 then
  83.                     local randomFriend = friends[math.random(1,#friends)]
  84.                     username_here = randomFriend
  85.                     if customName ~= '' then
  86.                         username_here = customName
  87.                     end
  88.                     local text = '/w ' .. v.Name .. ' ##################################################################### {System} Your friend ' .. username_here .. ' has joined the game}'
  89.                     game:GetService('ReplicatedStorage').DefaultChatSystemChatEvents.SayMessageRequest:FireServer(text,'All')
  90.                 end
  91.             end
  92.         end
  93.     end
  94.     wait()
  95.     finished = true
  96.     if botMode then
  97.         game:GetService('TeleportService'):Teleport(4693806589)
  98.     end
  99. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement