Your trying to use the method that gets the players name by userid. You also don’t have to use 2 remotes if they are different, all you need todo is check what it is
I believe the solution your looking for is
This is how I would do it, I am unsure if this is really efficient or readable so I left comments and I apologize if this didn’t solve anything.
-- Remote script
local Event = nil -- Replace nil with your event.
textbox.FocusLost:Connect(function(Send: boolean)
if Send and textbox.Text then
Event:FireServer(textbox.Text)
end
end)
-- Main
local Players = game:GetService("Players") -- Better to declare service names instead of game.Players
local ServerStorage = game:GetService("ServerStorage") -- I believe this returns nil if your script isn't in ServerStorage or ServerScriptService?
local Remote = nil -- Replace nil with your remote
local function GetAppearanceFromPlayer(input) -- Gets the appearance using 2 methods and checking what type of input was given
local Appearance = nil
local UserID = nil
if typeof(input) == "string" then -- unsure if this is how typeof works, I never use it. Please fix what it is equal to if I'm incorrect.
UserID = Players:GetUserIdFromNameAsync(input) -- This only applies to account name and not display names
elseif typeof(input) == "number" then
UserID = Players:GetPlayerByUserId(input) -- You can also use UserIds to get the appearance!
end
if UserID then
Appearance = Players:GetHumanoidDescriptionFromUserId(UserID) -- Checks if the UserID was found, and gets the appearance
end
return Appearance -- Only returns nil if the UserID never was a players id
end
Remote.OnServerEvent:Connect(function(Player: Player, User: string | number) -- Replaced Username: name -> User: string | number which allows the usage of userids and usernames
for _, value in pairs(ServerStorage:GetDescendants()) do
if value:IsA("Model") and value.Name == "Dummy" then
local Character = value
local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
local Description = GetAppearanceFromPlayer(User)
if Character and Humanoid and Description then
Humanoid:ApplyAppearance(Description)
end
end
end
end)
If you have any errors with this script please reply back.
EDIT: To explain what this is doing is, when you fireserver the Remote, it checks the entire ServerStorage for models with the name Dummy which I assume your looking for. It then gets the Character and Humanoid then calls the GetAppearanceFromPlayer function I created with the textbox’s text you sent, which then returns the UserID even if its string or number. And if the Character, Humanoid, and Description are returned not as nil then it will apply the humanoid. (This might be a little confusing, I believe someone could make this a little easy to understand?)