Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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?

3 comments

0

math.random(friend)

0

all you need to do is define friend

0

?

1 answer

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...

1 comment

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.