Removing packages script behaves wierdly

hi! So I am making a game which has a removing package script of content provided below.
The script should force player character to be blocky
image
However it does not do that, in the case provided above in coverted avatar like this to the picture number 1
image.

If the player doesn’t have a head package the head size decreases making it look quite stupid. By attempting to debug the issue I found out that when script is disabled and I set BodyProportionScale to 1 the head resizes itself like when the script is enabled so I tried to set it to 0 in humanoid description with no effect.

Example of the issue that is occuring:
(No head package equipped)
image
Example of how it should be
image

I also tried removing character restrictions in the game settings under Avatar section but it led me to no effect on the issue.

Script:

local Players = game.Players	

function PlayerJoined(Player)
	local function RemoveMeshes(Character)
		wait(2)
		local Humanoid = Character:WaitForChild("Humanoid")	
		local CurrentDescription = Humanoid:GetAppliedDescription() 	-- finds body description
		CurrentDescription.Head = 0
		CurrentDescription.LeftArm = 0
		CurrentDescription.LeftLeg = 0
		CurrentDescription.RightArm = 0
		CurrentDescription.RightLeg = 0
		CurrentDescription.Torso = 0
		Humanoid:ApplyDescription(CurrentDescription)
		Humanoid:WaitForChild("BodyProportionScale").Value = 0
		for _, child in ipairs(Character:GetChildren()) do --Remove hitboxes
			local handle = child:FindFirstChild("Handle")
			if handle then
				handle.CanTouch = false
				handle.CanQuery = false
			end
		end
	end
	Player.CharacterAppearanceLoaded:Connect(RemoveMeshes) -- forces description to values
end
Players.PlayerAdded:Connect(PlayerJoined)

Apparently placing CurrentDescription.ProportionScale = 0 in the first line instead of the lest of defining humanoid description and adding the ID of default head package instead of setting it to 0 fixes the issue, not sure why and how but it works I suppose.


function PlayerJoined(Player)
	local function RemoveMeshes(Character)
		wait(2)
		local Humanoid = Character:WaitForChild("Humanoid")	
		local CurrentDescription = Humanoid:GetAppliedDescription() 	
		CurrentDescription.ProportionScale = 0
		CurrentDescription.Head = 2432102561
		CurrentDescription.LeftArm = 0
		CurrentDescription.LeftLeg = 0
		CurrentDescription.RightArm = 0
		CurrentDescription.RightLeg = 0
		CurrentDescription.Torso = 0
		Humanoid:ApplyDescription(CurrentDescription)
		for _, child in ipairs(Character:GetChildren()) do 
			local handle = child:FindFirstChild("Handle")
			if handle then
				handle.CanTouch = false
				handle.CanQuery = false
			end
		end
	end
	Player.CharacterAppearanceLoaded:Connect(RemoveMeshes) 
end
Players.PlayerAdded:Connect(PlayerJoined)

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