How to scale whole model

I am wanting to scale a model down, however can’t do so easily.

I’ve tried scaling each part of the model, but it ruins stuff, as seen below with a sign.
image
Since I scale the sign part and pole part, they get scaled from their centres, and thus become disjointed.

Original Sign model
image

ClonedItem.Anchored = false
ClonedItem.CanCollide = false
ClonedItem.CanTouch = false

ClonedItem.Size *= 0.25

if #ClonedItem:GetChildren() > 0 then -- Parts inside the part
	for _, part in pairs(ClonedItem:GetChildren()) do
		if not part:IsA("BasePart") and not part:IsA("MeshPart") and not part:IsA("UnionOperation") then continue end
		
		part.Anchored = false
		part.CanCollide = false
		part.CanTouch = false
		
		part.Size *= 0.25
		
		local Weld = Instance.new("WeldConstraint")
		Weld.Part0 = ClonedItem
		Weld.Part1 = part
		
		Weld.Parent = ClonedItem
	end
end
3 Likes

My game uses this function, but I don’t know how it works because I stole it from someone on DevForum LOL

If someone can explain what :lerp is without sending me the documentation website that I don’t understand that’d be appreciated <3

-- Don't forget to add a PrimaryPart!!!!!

function resizeModel(model,a)
	local base = model.PrimaryPart.Position
	for _,part in pairs(model:GetDescendants()) do
		if part:IsA("BasePart") then
			part.Position = base:Lerp(part.Position,a)
			part.Size *= a
		end
	end
end

resizeModel(workspace.Model,1/2) --> sizes to 1/2

Edit, found it:

13 Likes

Problem with it is my objects are stored like this:
image

‘ClonedItem’ is the ‘Root’ part here. I only clone the Rootpart of the model to hold, as the model itself contains several other parts not needed when holding the item

EDIT Nvm, just reworked my code to allow this to work :+1:

1 Like

Hello (even tho I don’t want to bump a 2 years old topic). For any future scripters, you can now use Model:ScaleTo(newScaleFactor: number).

10 Likes