Basically I want to make a npc that you can change to any character you want by typing in the username of the character. Like MrFlimFlam to change it to look like flamingo’s avatar.
I’ve tried searching up how to on youtube and dev forum but couldn’t find any answers. Does anyone know how i can do this?
There are two functions that may come in handy here, those are:
- Players’ GetHumanoidDescriptionFromUserId
- Humanoid’s ApplyDescription
These can be used together like so:
local dummy = workspace.Dummy
local function create_dummy(p_name)
local user_id = game:GetService("Players"):GetUserIdFromNameAsync(p_name)
local h_desc = game:GetService("Players"):GetHumanoidDescriptionFromUserId(user_id)
dummy.Humanoid:ApplyDescription(h_desc)
end
Do note, this function must be called from the server, as required by GetHumanoidDescriptionFromUserId
, the dummy
variable must be changed to the location of the dummy, it’d also be advised to pcall this function incase the player name doesn’t exist: pcall(create_dummy, "Roblox")
.
1 Like