HumanoidDescription is not being applied

Hi, I am trying to make the player look a bit wonky with descriptions, but that’s not working out, not even errors are occuring. Here is my code:

for i, v in pairs(game.Players:GetPlayers()) do
						if v:FindFirstChild("Murderer") or v:FindFirstChild("Sheriff") or v:FindFirstChild("Innocent") then
							local BodyDepthRNG = math.random(2,5)
							local BodyHeightRNG = math.random(2,3)
							local BodyWidthRNG = math.random(1,3)
							local HeadRNG = math.random(1,2)
							
							local Description = v.Character.Humanoid:GetAppliedDescription()
							
							Description.BodyDepthScale.Value = v.Character.Humanoid.BodyDepthScale.Value * BodyDepthRNG
							Description.BodyHeightScale.Value = v.Character.Humanoid.BodyHeightScale.Value * BodyHeightRNG
							Description.BodyWidthScale.Value = v.Character.Humanoid.BodyWidthScale.Value * BodyWidthRNG
							Description.HeadScale.Value = v.Character.Humanoid.HeadScale.Value * HeadRNG
							
							v.Character.Humanoid:ApplyDescription(Description)
						end
					end

for i, v in pairs(game.Players:GetPlayers()) do
					if v:FindFirstChild("Murderer") or v:FindFirstChild("Sheriff") or v:FindFirstChild("Innocent") then
						local Description = v.Character.Humanoid:GetAppliedDescription()

						Description.BodyDepthScale.Value = v.Character.Humanoid.BodyDepthScale.Value * 1/v.Character.Humanoid.BodyDepthScale.Value
						Description.BodyHeightScale.Value = v.Character.Humanoid.BodyHeightScale.Value * 1/v.Character.Humanoid.BodyHeightScale.Value
						Description.BodyWidthScale.Value = v.Character.Humanoid.BodyWidthScale.Value * 1/v.Character.Humanoid.BodyWidthScale.Value
						Description.HeadScale.Value = v.Character.Humanoid.HeadScale.Value * 1/v.Character.Humanoid.HeadScale.Value
						
						v.Character.Humanoid:ApplyDescription(Description)
					end
				end

NOTE: If statements are reached.

Not only are you using the wrong names of the properties on HumanoidDescriptions, you’re also trying to access .Value which isn’t a thing on HumanoidDescriptions, that’s for ValueObjects.

Example of one of the lines, now fixed.

Description.WidthScale = v.Character.Humanoid.BodyWidthScale.Value * 1/v.Character.Humanoid.BodyWidthScale.Value

Get the correct property names from here: HumanoidDescription | Documentation - Roblox Creator Hub

Description.WidthScale corresponds to Humanoid.BodyWidthScale.Value

1 Like

Hmm, nothing is changing. I’m getting this error

After when everything returns back to normal, the colors of the player are different as well.

That error might be unrelated? I’m not sure as to how that error would happen when your code snippet doesn’t use that function…
Do you use GetUserIdFromNameAsync anywhere in your code?

No, this is my current code:

for i, v in pairs(game.Players:GetPlayers()) do
						if v:FindFirstChild("Murderer") or v:FindFirstChild("Sheriff") or v:FindFirstChild("Innocent") then
							local BodyDepthRNG = math.random(2,5)
							local BodyHeightRNG = math.random(2,3)
							local BodyWidthRNG = math.random(1,3)
							local HeadRNG = math.random(1,2)
							
							local Humanoid = v.Character:FindFirstChild("Humanoid")
							
							local Description = v.Character.Humanoid:GetAppliedDescription()
							
							Description.DepthScale = v.Character.Humanoid.BodyDepthScale.Value * BodyDepthRNG
							Description.HeightScale = v.Character.Humanoid.BodyHeightScale.Value * BodyHeightRNG
							Description.WidthScale = v.Character.Humanoid.BodyWidthScale.Value * BodyWidthRNG
							Description.HeadScale = v.Character.Humanoid.HeadScale.Value * HeadRNG
							
							v.Character.Humanoid:ApplyDescription(Description)
						end
					end

				for i, v in pairs(game.Players:GetPlayers()) do
					if v:FindFirstChild("Murderer") or v:FindFirstChild("Sheriff") or v:FindFirstChild("Innocent") then
						local Description = v.Character.Humanoid:GetAppliedDescription()

						Description.DepthScale = v.Character.Humanoid.BodyDepthScale.Value * 1/v.Character.Humanoid.BodyDepthScale.Value
						Description.HeightScale = v.Character.Humanoid.BodyHeightScale.Value * 1/v.Character.Humanoid.BodyHeightScale.Value
						Description.WidthScale = v.Character.Humanoid.BodyWidthScale.Value * 1/v.Character.Humanoid.BodyWidthScale.Value
						Description.HeadScale = v.Character.Humanoid.HeadScale.Value * 1/v.Character.Humanoid.HeadScale.Value
						
						v.Character.Humanoid:ApplyDescription(Description)
					end
				end

I wonder if I need to remove .Value at the first set of changes.

Sorry, I didn’t explain what I meant well, I meant do you use that GetUserIdFromNameAsync in your entire game, not just the code snippet.
Also you don’t need to remove anymore .Value’s. You’ve already gotten rid of all of the bad ones.

No, it wasn’t called or used at all. It started appearing after I added those in.

for i, v in pairs(game.Players:GetPlayers()) do
	if v:FindFirstChild("Murderer") or v:FindFirstChild("Sheriff") or v:FindFirstChild("Innocent") then
		local BodyDepthRNG = math.random(2,5)
		local BodyHeightRNG = math.random(2,3)
		local BodyWidthRNG = math.random(1,3)
		local HeadRNG = math.random(1,2)
		
		local Description = v.Character.Humanoid:GetAppliedDescription()
		
		Description.DepthScale *= BodyDepthRNG
		Description.HeightScale *= BodyHeightRNG
		Description.WidthScale *= BodyWidthRNG
		Description.HeadScale *= HeadRNG
		
		v.Character.Humanoid:ApplyDescription(Description)
	end
end

for i, v in pairs(game.Players:GetPlayers()) do
if v:FindFirstChild("Murderer") or v:FindFirstChild("Sheriff") or v:FindFirstChild("Innocent") then
	local Description = v.Character.Humanoid:GetAppliedDescription()

	Description.DepthScale *= 1/Description.DepthScale
	Description.HeightScale *= 1/Description.HeightScale
	Description.WidthScale *= 1/Description.WidthScale
	Description.HeadScale *= 1/Description.HeadScale
	
	v.Character.Humanoid:ApplyDescription(Description)
end
end

Try this? I don’t think this would work as this shouldn’t change the result at all but I’m stumped here…
I changed the code to use the Description’s scale instead of the Humanoid’s scale, which should be the same values anyway. Even if this doesn’t fix it, it still improves the quality of the code a bit.
(variable = variable * 2 is the same as variable *= 2)

I’m starting to think the problem is somewhere else in the game, not this code snippet. Do you respawn characters when a round starts? If so, the problem could be that the description is applied BEFORE the respawn, not AFTER the respawn, which would cause the changes to be reset.

This didn’t work, the players are put into characters before the round starts and in each character it has the description piece.