You must get the Player’s UserId, as that is what you must feed into :GetCharacterAppearanceAsync(). You can do this by using the Players:GetUserIdFromNameAsync function.
Sorry if this sounds stupid, because this type of scripting is all new to me but I’ve got something (probably doesn’t work) but I’m trying to compile bits of different developer hub posts.
So I hvae this
That is a local script inside the Textbox which you enter a users name.
This is the character I want to change to the users avatar.
I would use a Remote Event to then fire off sending the player name as an argument, then picking up server side to set the player’s character appearance.
Try:
game.ReplicatedStorage.YourRemote.OnServerEvent:Connect(function(player,charID)
local character = game.Players:GetCharacterAppearanceAsync(charID)
character.Name = player.Name
player.Character = character
character.Parent = workspace
end)