Help with humanoiddescription

I need help with HumanoidDescriptions. I’m trying to make a “Reset Avatar” button that will reset your avatar with the one you currently have on Roblox website. (I’m trying to make an avatar outfit try-on game)

I’m firing a RemoteEvent from a LocalScript to ServerScript which would then allow others to see the resetted avatar instead of doing it client side.

LocalScript

local Players = game:GetService("Players")
local remoteEvent = script.Parent.ButtonHandler.ResetFired

local button = script.Parent

button.MouseButton1Click:Connect(function()
	local player = Players.LocalPlayer
	local humanoid = player.Character and player.Character:FindFirstChild("Humanoid")

	if humanoid then
		local playerId = player.UserId

		local humanoidDescription = Players:GetHumanoidDescriptionFromUserId(playerId)

		remoteEvent:FireServer(player, humanoidDescription)
	end
end)

ServerScript

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = script.Parent.ButtonHandler.ResetFired

remoteEvent.OnServerEvent:Connect(function(player, humanoidDescription)
	local humanoid = player.Character and player.Character:FindFirstChild("Humanoid")

	if humanoid and humanoidDescription then
		humanoid:ApplyDescription(humanoidDescription)
	end
end)

You should modify the LocalScript as follows to properly fetch the HumanoidDescription and pass it to the ServerScript:

local Players = game:GetService("Players")
local remoteEvent = script.Parent.ButtonHandler.ResetFired

local button = script.Parent

button.MouseButton1Click:Connect(function()
    local player = Players.LocalPlayer
    local humanoid = player.Character and player.Character:FindFirstChild("Humanoid")

    if humanoid then
        local playerId = player.UserId

        -- correct way to get the HumanoidDescription is by using GetHumanoidDescriptionFromUserAge
        local humanoidDescription = Players:GetHumanoidDescriptionFromUserAge(playerId)

        remoteEvent:FireServer(player, humanoidDescription)
    end
end)

In your ServerScript, the code appears to be correct. When a player clicks the “Reset Avatar” button, it will send a request to the server to reset their avatar using the HumanoidDescription obtained from the player’s UserId. Good luck with your avatar outfit try-on game!

Firstly, it seems like your ServerScript is on the client-side. Try putting it somewhere on the server-side (i recommend ServerScriptService).

Secondly, put the RemoteEvent inside of the ReplicatedStorage.

Lastly, I noticed you sent the HumanoidDescription through the remoteEvent to the server, which is useless.

LocalScript:

local Players = game:GetService("Players")
local remoteEvent = game.ReplicatedStorage.RemoteEvent

local button = script.Parent

button.MouseButton1Click:Connect(function()
	local player = Players.LocalPlayer

	remoteEvent:FireServer(player)
end)

ServerScript:

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage.RemoteEvent

remoteEvent.OnServerEvent:Connect(function(player)
	local humanoid = player.Character and player.Character:FindFirstChild("Humanoid")

	if humanoid then
		local humanoidDescription = Players:GetHumanoidDescriptionFromUserId(player.UserId)
		humanoid:ApplyDescription(humanoidDescription)
	end
end)

Hope i helped!

3 Likes

Seems like ChatGPT is having a hard time LOL
GetHumanoidDescriptionFromUserAge doesnt even exist. If you want to help then do it right

1 Like

Apologies, I was self taught by Youtube videos and ChatGPT.

It seems like you’re just copying questions on the DevForum and pasting them into ChatGPT. My point is, do things right. If you don’t have the knowledge then don’t bother trying as you’re wasting people’s time. You proved my point with the GetHumanoidDescriptionFromUserAge because it doesn’t even exist on Roblox Studio. Are you really trying to farm solutions on the DevForum?

1 Like

You wrote all that just to make me think I use ChatGPT? Great!

Heres a cookie! :cookie:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.