function module.UpdateHipHeight(w,Y)local s=Y:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")if s then local w=Y:FindFirstChild("\076\101\102\116\070\111\111\116")if w then s:BuildRigFromAttachments()else s.HipHeight=0 end end end function module.ChangeAllBodyColors(s,Y,w)local M=(main:GetModule("\099\102")):GetHumanoid(Y)if M then local s=M:GetAppliedDescription()s.HeadColor=w s.LeftArmColor=w s.RightArmColor=w s.LeftLegColor=w s.RightLegColor=w s.TorsoColor=w pcall(function()M:ApplyDescription(s)end)if Y.Character:FindFirstChild("\070\097\107\101\072\101\097\100")then for Y,s in pairs(Y.Character:GetChildren())do if string.sub(s.Name,1,4)=="\070\097\107\101"and s:IsA("\066\097\115\101\080\097\114\116")then s.Color=w end end end end end function module.ChangeProperty(M,Y,w,s)local x=(main:GetModule("\099\102")):GetHumanoid(Y)if x then local Y=x:GetAppliedDescription()Y[w]=s pcall(function()x:ApplyDescription(Y)end)end end function module.ChangeProperties(s,Y,w)local M=(main:GetModule("\099\102")):GetHumanoid(Y)if M then for Y,s in pairs(M:GetChildren())do local M=string.lower(s.Name)for Y,w in pairs(w)do Y=string.lower(Y)if string.sub(M,-(#Y))==Y then s.Value=w break end end end end end function module.ClearProperty(s,Y,w)local M=(main:GetModule("\099\102")):GetHumanoid(Y)if M then local Y=M:GetAppliedDescription()Y[w]=""pcall(function()M:ApplyDescription(Y)end)end end function module.ResetProperty(s,Y,w)local M=(main:GetModule("\099\102")):GetHumanoid(Y)if M then local s=main.players:GetHumanoidDescriptionFromUserId(Y.UserId)local x=M:GetAppliedDescription()x[w]=s[w]pcall(function()M:ApplyDescription(x)end)end end function module.SetScale(M,Y,w,s)local x=(main:GetModule("\099\102")):GetHumanoid(Y)if x then local Y=x:GetAppliedDescription()Y[w.."\083\099\097\108\101"]=s pcall(function()x:ApplyDescription(Y)end)end end function module.AddAccessory(s,Y,w)local M=(main:GetModule("\099\102")):GetHumanoid(Y)if M then local Y=(main:GetModule("\099\102")):GetProductInfo(w)if Y.AssetTypeId then local s=accessoryTypes[Y.AssetTypeId]if s and Y.AssetTypeId then local Y=M:GetAppliedDescription()Y[s]=Y[s]..("\044"..w)pcall(function()M:ApplyDescription(Y)end)end end end end function module.ClearAccessories(w,Y)local s=(main:GetModule("\099\102")):GetHumanoid(Y)if s then local Y=s:GetAppliedDescription()for w,s in pairs(accessoryTypes)do Y[s]=""end Y.HatAccessory=""pcall(function()s:ApplyDescription(Y)end)end end function module.CreateFakeBodyPart(s,Y,w)local M="\070\097\107\101"..w.Name local x=Y:FindFirstChild(M)if not x then local s=w:FindFirstChildOfClass("\083\112\101\099\105\097\108\077\101\115\104")if w.Name=="\072\101\097\100"and s then if s.MeshType==Enum.MeshType.Head then x=main.server.Assets.FakeHead:Clone()local Y=w.Size local M=s.Scale.Y/1.25 x.Size=Vector3.new((Y.X*.6)*M,(Y.Y*1.2)*M,(Y.Z*1.19)*M)x.CFrame=w.CFrame*CFrame.new(0,s.Offset.Y,0)else x=w:Clone()x:ClearAllChildren();(s:Clone()).Parent=x end else x=w:Clone()x:ClearAllChildren()end x.CanCollide=false x.Name="\070\097\107\101"..w.Name local M=Instance.new("\087\101\108\100\067\111\110\115\116\114\097\105\110\116")M.Part0=x M.Part1=w M.Parent=x w.Transparency=1 x.Parent=Y end x.Color=w.Color return x end function module.ClearFakeBodyParts(w,Y)for Y,w in pairs(Y:GetChildren())do if w:IsA("\066\097\115\101\080\097\114\116")then if string.sub(w.Name,1,4)=="\070\097\107\101"then w:Destroy()elseif w.Name~="\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116"then w.Transparency=0 end end end end function module.SetHeadMeshSize(s,Y,w)local M=(main:GetModule("\099\102")):GetHead(Y)if M then local s=M:FindFirstChildOfClass("\083\112\101\099\105\097\108\077\101\115\104")if s then local M=s:FindFirstChild("\079\114\105\103\105\110\097\108\083\105\122\101")if not M then M=Instance.new("\086\101\099\116\111\114\051\086\097\108\117\101")M.Name="\079\114\105\103\105\110\097\108\083\105\122\101"M.Value=s.Scale M.Parent=s end;(main:GetModule("\077\111\114\112\104\072\097\110\100\108\101\114")):ClearAccessories(Y)s.Scale=Vector3.new(M.Value.X*w.X,M.Value.Y*w.Y,M.Value.Z*w.Z)local x=0 if w.Y==.75 then x=-0.15 elseif w.Y==2 then x=.45 end s.Offset=Vector3.new(0,x,0)end end end function module.ChangeFace(s,Y,w)local M=Y:FindFirstChild("\072\101\097\100")if M then local Y=M:FindFirstChild("\102\097\099\101")if Y then Y.Texture="\114\098\120\097\115\115\101\116\105\100\058\047\047"..w end end end function module.BecomeTargetPlayer(s,Y,w)local M=(main:GetModule("\099\102")):GetHumanoid(Y)if M then local Y,s Y,s=pcall(function()return main.players:GetHumanoidDescriptionFromUserId(w)end)if Y then pcall(function()M:ApplyDescription(s)end)end end end function module.ClearCharacter(w,Y)for Y,w in pairs(Y:GetDescendants())do if w:IsA("\083\104\105\114\116")or w:IsA("\083\104\105\114\116\071\114\097\112\104\105\099")or w:IsA("\080\097\110\116\115")or w:IsA("\065\099\099\101\115\115\111\114\121")or w:IsA("\072\097\116")or w:IsA("\067\104\097\114\097\099\116\101\114\077\101\115\104")or w:IsA("\066\111\100\121\067\111\108\111\114\115")then w:Destroy()elseif w.Name=="\067\104\101\115\116"or w.Name=="\065\114\109\049"or w.Name=="\065\114\109\050"or w.Name=="\076\101\103\049"or w.Name=="\076\101\103\050"or w.Name=="\069\120\116\114\097\070\101\097\116\117\114\101\115"or w.Name=="\069\120\116\114\097\070\097\099\101"then w:Destroy()end end end
-- << FUNCTIONS >>
function module:UpdateHipHeight(character)
	--[[
	local hrp = character:FindFirstChild("HumanoidRootPart")
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	local leftFoot = character:FindFirstChild("LeftFoot")
	if hrp and humanoid and leftFoot then
		local bottomOfHumanoidRootPart = hrp.Position.Y - (1/2 * hrp.Size.Y)
		local bottomOfFoot = leftFoot.Position.Y - (1/2 * leftFoot.Size.Y) -- Left or right. Chose left arbitrarily
		local newHipHeight = bottomOfHumanoidRootPart - bottomOfFoot
		humanoid.HipHeight = newHipHeight
	end
	--]]
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	if humanoid then
		local leftFoot = character:FindFirstChild("LeftFoot")
		if leftFoot then
			humanoid:BuildRigFromAttachments()
		else
			humanoid.HipHeight = 0
		end
	end
end
function module:ChangeAllBodyColors(plr, newColor)
	local humanoid = main:GetModule("cf"):GetHumanoid(plr)
	if humanoid then
		local desc = humanoid:GetAppliedDescription()
		desc.HeadColor = newColor
		desc.LeftArmColor = newColor
		desc.RightArmColor = newColor
		desc.LeftLegColor = newColor
		desc.RightLegColor = newColor
		desc.TorsoColor = newColor
		pcall(function()
			humanoid:ApplyDescription(desc)
		end)
		if plr.Character:FindFirstChild("FakeHead") then
			for a, b in pairs(plr.Character:GetChildren()) do
				if string.sub(b.Name, 1, 4) == "Fake" and b:IsA("BasePart") then
					b.Color = newColor
				end
			end
		end
	end
end

function module:ChangeProperty(plr, propertyName, propertyValue)
	local humanoid = main:GetModule("cf"):GetHumanoid(plr)
	if humanoid then
		local desc = humanoid:GetAppliedDescription()
		desc[propertyName] = propertyValue
		pcall(function()
			humanoid:ApplyDescription(desc)
		end)
	end
end

function module:ChangeProperties(plr, properties)
	local humanoid = main:GetModule("cf"):GetHumanoid(plr)
	if humanoid then
		--[[
		local desc = humanoid:GetAppliedDescription()
		for pName, pValue in pairs(properties) do
			desc[pName] = pValue
		end
		pcall(function() humanoid:ApplyDescription(desc) end)--]]
		for a, b in pairs(humanoid:GetChildren()) do
			local targetName = string.lower(b.Name)
			for propName, propValue in pairs(properties) do
				propName = string.lower(propName)
				if string.sub(targetName, -#propName) == propName then
					b.Value = propValue
					break
				end
			end
		end
	end
end

function module:ClearProperty(plr, propertyName)
	local humanoid = main:GetModule("cf"):GetHumanoid(plr)
	if humanoid then
		local desc = humanoid:GetAppliedDescription()
		desc[propertyName] = ""
		pcall(function()
			humanoid:ApplyDescription(desc)
		end)
	end
end

function module:ResetProperty(plr, propertyName)
	local humanoid = main:GetModule("cf"):GetHumanoid(plr)
	if humanoid then
		local mainDesc = main.players:GetHumanoidDescriptionFromUserId(plr.UserId)
		local desc = humanoid:GetAppliedDescription()
		desc[propertyName] = mainDesc[propertyName]
		pcall(function()
			humanoid:ApplyDescription(desc)
		end)
	end
end

function module:SetScale(plr, scaleType, scaleValue)
	local humanoid = main:GetModule("cf"):GetHumanoid(plr)
	if humanoid then
		local desc = humanoid:GetAppliedDescription()
		desc[scaleType .. "Scale"] = scaleValue
		pcall(function()
			humanoid:ApplyDescription(desc)
		end)
	end
end

function module:AddAccessory(plr, accessoryId)
	local humanoid = main:GetModule("cf"):GetHumanoid(plr)
	if humanoid then
		local info = main:GetModule("cf"):GetProductInfo(accessoryId)
		if info.AssetTypeId then
			local propertyName = accessoryTypes[info.AssetTypeId]
			if propertyName and info.AssetTypeId then
				local desc = humanoid:GetAppliedDescription()
				desc[propertyName] = desc[propertyName] .. "," .. accessoryId
				pcall(function()
					humanoid:ApplyDescription(desc)
				end)
			end
		end
	end
end

function module:ClearAccessories(plr)
	local humanoid = main:GetModule("cf"):GetHumanoid(plr)
	if humanoid then
		local desc = humanoid:GetAppliedDescription()
		for i, v in pairs(accessoryTypes) do
			desc[v] = ""
		end
		desc.HatAccessory = ""
		pcall(function()
			humanoid:ApplyDescription(desc)
		end)
	end
end

function module:CreateFakeBodyPart(character, bodyPart)
	local fakePartName = "Fake" .. bodyPart.Name
	local fakePart = character:FindFirstChild(fakePartName)
	if not fakePart then
		local mesh = bodyPart:FindFirstChildOfClass("SpecialMesh")
		if bodyPart.Name == "Head" and mesh then
			if mesh.MeshType == Enum.MeshType.Head then
				fakePart = main.server.Assets.FakeHead:Clone()
				local size = bodyPart.Size
				local scaleUp = mesh.Scale.Y / 1.25
				fakePart.Size = Vector3.new(size.X * 0.6 * scaleUp, size.Y * 1.2 * scaleUp, size.Z * 1.19 * scaleUp)
				fakePart.CFrame = bodyPart.CFrame * CFrame.new(0, mesh.Offset.Y, 0)
			else
				fakePart = bodyPart:Clone()
				fakePart:ClearAllChildren()
				mesh:Clone().Parent = fakePart
			end
		else
			fakePart = bodyPart:Clone()
			fakePart:ClearAllChildren()
		end
		fakePart.CanCollide = false
		fakePart.Name = "Fake" .. bodyPart.Name
		local weld = Instance.new("WeldConstraint")
		weld.Part0 = fakePart
		weld.Part1 = bodyPart
		weld.Parent = fakePart
		bodyPart.Transparency = 1
		fakePart.Parent = character
	end
	fakePart.Color = bodyPart.Color
	return fakePart
end

function module:ClearFakeBodyParts(character)
	for a, b in pairs(character:GetChildren()) do
		if b:IsA("BasePart") then
			if string.sub(b.Name, 1, 4) == "Fake" then
				b:Destroy()
			elseif b.Name ~= "HumanoidRootPart" then
				b.Transparency = 0
			end
		end
	end
end

function module:SetHeadMeshSize(plr, scale)
	local head = main:GetModule("cf"):GetHead(plr)
	if head then
		local mesh = head:FindFirstChildOfClass("SpecialMesh")
		if mesh then
			local osize = mesh:FindFirstChild("OriginalSize")
			if not osize then
				osize = Instance.new("Vector3Value")
				osize.Name = "OriginalSize"
				osize.Value = mesh.Scale
				osize.Parent = mesh
			end
			main:GetModule("MorphHandler"):ClearAccessories(plr)
			mesh.Scale = Vector3.new(osize.Value.X * scale.X, osize.Value.Y * scale.Y, osize.Value.Z * scale.Z)
			local yOffset = 0
			if scale.Y == 0.75 then
				yOffset = -0.15
			elseif scale.Y == 2 then
				yOffset = 0.45
			end
			mesh.Offset = Vector3.new(0, yOffset, 0)
		end
	end
end

function module:ChangeFace(char, faceId)
	local head = char:FindFirstChild("Head")
	if head then
		local face = head:FindFirstChild("face")
		if face then
			face.Texture = "rbxassetid://" .. faceId
		end
	end
end

function module:BecomeTargetPlayer(player, targetId)
	local humanoid = main:GetModule("cf"):GetHumanoid(player)
	if humanoid then
		local success, desc
		--[[local plr = main.players:GetPlayerByUserId(targetId)
		if plr and not useOriginal then
			success, desc = pcall(function() return plr.Character.Humanoid:GetAppliedDescription() end)
		else--]]
		success, desc = pcall(function()
			return main.players:GetHumanoidDescriptionFromUserId(targetId)
		end)
		--end
		if success then
			pcall(function()
				humanoid:ApplyDescription(desc)
			end)
		end
	end
end

function module:ClearCharacter(character)
	for a, b in pairs(character:GetDescendants()) do
		if
			b:IsA("Shirt")
			or b:IsA("ShirtGraphic")
			or b:IsA("Pants")
			or b:IsA("Accessory")
			or b:IsA("Hat")
			or b:IsA("CharacterMesh")
			or b:IsA("BodyColors")
		then
			b:Destroy()
		elseif
			b.Name == "Chest"
			or b.Name == "Arm1"
			or b.Name == "Arm2"
			or b.Name == "Leg1"
			or b.Name == "Leg2"
			or b.Name == "ExtraFeatures"
			or b.Name == "ExtraFace"
		then
			b:Destroy()
		end
	end
end
