I have two scripts, one that logs chats and joins to discord, and another that prints the info about a users friends. How could I allow it to post the friends info to the discord via webhook?
logger:
local Players = game:GetService("Players") local HttpService = game:GetService("HttpService") local webhook = "YOUR WEBHOOK HERE" Players.PlayerAdded:Connect(function(plr) plr.Chatted:Connect(function(msg) local data = { content = msg; username = plr.Name; avatar_url = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userId="..plr.UserId } HttpService:PostAsync(webhook, HttpService:JSONEncode(data)) end) end)
Friend-fetcher:
local friendsList = game:GetService("Players"):GetFriendsAsync(16826035) --Had to use a friend's UserId since he had more friends than I did. These are all of the pages of the player's friends. for page=1,4 do --4*50 = 200, you can not have more than 200 friends. for _,friend in pairs(friendsList:GetCurrentPage()) do for key,value in pairs(friend) do print(key .. ": \t" .. tostring(value)) end end if page ~= 4 then local pass,err = pcall(function() friendsList:AdvanceToNextPageAsync() --If we can not AdvanceToNextPage, then the pcall will error resulting in pass being false. end) if not pass then --If pass is true, then the not will negate that making the if statement false and not perform the logic. If pass is false, then the not statement will negate that and run the if statement as true. If statements can only run on true statements. break end end end