Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how would i make a script that allows it to show a random friend from there friends list?

Asked by 5 years ago
Edited 5 years ago

lets say i want to add friends that are friends with the user like this game here in a form of a npc. https://www.roblox.com/games/2142363973/T-Pose-Meme the game lists what i want, and it has that thing i said, im no good at explaining, how is that possible? does anybody know how it does that?

0
math.random(friend) greatneil80 2647 — 5y
0
all you need to do is define friend greatneil80 2647 — 5y
0
? DenisVsDoge -31 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

I'd recommend you utilize HTTPService and send GET /users/{userId}/friends request. (https://api.roblox.com/users/{userId}/friends) You should then randomly select a child from the decoded friend return.



function print_random_friend() plr = game.Players.LocalPlayer friend_url = 'https://api.roblox.com/users/'..plr.UserId..'/friends' local friends = game:GetService("HttpService"):GetAsync(friend_url) math.randomseed(tick()) ...Rest of the script...
0
You can not access roblox domains with HttpService. you need to use a API/Proxy. and only can use HttpService with ServerScript, not LocalScript. yHasteeD 1819 — 5y
Ad

Answer this question