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

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
