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

How would I get the Local Player's friend clone?

Asked by 4 years ago

So, I have been trying to make a new game, but I ran into a problem. I couldn't figure out how to make the Local player's friend's model, show up. I tried the Developer hub, but I'm not 100% good in scripting, and anyone please help?

What I used. https://developer.roblox.com/en-us/api-reference/function/Player/GetFriendsOnline

(Note I'm trying to get the Client's friends, not there friend list/table.).

2 answers

Log in to vote
0
Answered by 4 years ago

You would have to make the Clone() script, a server script instead of a local script.

Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

What you're actually looking for is GetCharacterAppearanceAsync(), a function of the Players service. The function takes a user ID (int64) as its only argument and returns a model containing the assets that the player is wearing.

Here is such an example:

local P = game:GetService("Players")
local model = P:GetCharacterAppearanceAsync(1) -- In place of 1 you would insert the user ID
model.Parent = workspace

If done successfully, you should get a model in the Workspace.

Now, in your case, you want the LocalPlayer to be cloned. This is pretty simple: use a remote event that passes the LocalPlayer's UserID to the server.

0
So, how would I get the Local player's friend model though, or does this script include that? AshtonB465 3 — 4y
0
Remote events will pass the client that fired the event as the first argument to the server, so you can use GetCharacterAppearanceAsync(player.UserId) when the player argument is passed. DeceptiveCaster 3761 — 4y

Answer this question