I made a script that uses :GetUserIdFromNameAsync,:GetHumanoidDescriptionFromUserId and :ApplyDescription, I am trying to morph a NPC into a username that the player types which works fine except the clothes on the NPC.
First script:
--This is a LocalScript inside of a TextBox
local textBox = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("LoadCharacters")
textBox.FocusLost:Connect(function(enterPressed)
if enterPressed then
local userid = game.Players:GetUserIdFromNameAsync(textBox.Text)
if userid then
remoteEvent:FireServer(userid)
end
end
end)
Second script:
--This script is inside of ServerScriptService
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("LoadCharacters")
local NPCs = game.Workspace.People:GetChildren()
remoteEvent.OnServerEvent:Connect(function(player,userid)
local Description = game.Players:GetHumanoidDescriptionFromUserId(userid)
for i,v in pairs (NPCs) do
v.Humanoid:ApplyDescription(Description)
wait()
end
end)
Everytime I try to type in a username it loads in but without clothes.
Examples
Username: BawTheSeal (mine)
Username: Lxvinq_JJ (a friend)
Username: rachjumper (a developer)
None of the clothes show up as you can see.
Is there a fix to this? Or anything wrong with my script? (No errors in output)