Any alternatives to the resize function?

Hello there I have recently found out that when cloning a part you can’t use the resize() function on it and have found out that you also can’t use it with instance.new() but the only reason I was using the resize function is because I want to scale a part along its local axis. Does anyone know of another way I could (without a lot of complicated math)?

Perhaps use the BasePart.Size property? You can change the size by assigning it a new Vector3.

Here you go, this works on a local axis and replicates BasePart:Resize()

function resizeSurface(part, surface, amount)
	local normal = Vector3.fromNormalId(surface)
	local divisionFactor = 2
	
	if (surface == Enum.NormalId.Left or surface == Enum.NormalId.Bottom or surface == Enum.NormalId.Front) then
		normal = normal * -1
		divisionFactor = -2
	end
	
	local resizeAmount = normal * amount
	part.Size = part.Size + resizeAmount
	part.CFrame = part.CFrame * CFrame.new(resizeAmount/divisionFactor)
end

3 Likes