How to grow and shrink a model as opposed to a part?

I want to learn how to grow and shrink an entire model, as opposed to a singular part. This will help me with making some cooler effects- only problem is, I have no idea how to start.

RepStorage = game:GetService("ReplicatedStorage")
Remote = RepStorage.Remotes:WaitForChild("Rui1")
local TweenService = game:GetService("TweenService")
local Debris = game:GetService("Debris")


Remote.OnServerEvent:Connect(function(Player)
	
	local Clone = game.ServerStorage["Breath Skills"].ruithread:Clone()
	Clone.Parent = workspace
	Clone.CFrame = Player.Character.HumanoidRootPart.CFrame*CFrame.new(0,0,-6)
	local i = Player.Character.Head.Orientation.Y
	local goal = {}
	goal.Size = Clone.Size + Vector3.new(41.903, 41.265, 41.903)
	local info = TweenInfo.new(1,Enum.EasingStyle.Back,Enum.EasingDirection.InOut,0,false,.25)
	local tween = TweenService:Create(Clone,info,goal)
	tween:Play()
	
	wait(4)
	
	local goal2 = {}
	goal2.Size = Clone.Size - Clone.Size
	local info2 = TweenInfo.new(1,Enum.EasingStyle.Elastic,Enum.EasingDirection.InOut,0,false,.25)
	local tween2 = TweenService:Create(Clone,info2,goal2)
	tween2:Play()

end)

This is an example of my code, which grows and shrinks a singular part- I would like to replicate this but for growing and shrinking models.

I’ve tried messing around with the PrimaryPart feature, but that only grew and shrank the PrimaryPart of the model.

Any ideas on how to accomplish such a thing? I’ve tried reading up on previous posts, but they didn’t really seem to cater for my newbie-ness.

1 Like

You’ll need a multiplier number. Then multiply the size of every part with that multiplier. You’ll also need to multiply the offsets between every part’s position and a selected CFrame, which should probably be the center of the model.

Here’s some code.

local TweenService = game:GetService("TweenService")

local function resizeModel(model, mul, cfToOffsetFrom, tweenInfo)
    for i, v in ipairs(model:GetDescendants()) do
        if not v:IsA("BasePart") then
            continue
        end
        local goal = {
            Size = v.Size*mul
            Position = cfToOffsetFrom*(cfToOffsetFrom:PointToObjectSpace(v.Position)*mul)
        }
        TweenService:Create(v, tweenInfo, goal):Play()
    end
end

Edit: Now it does the tweening too.

5 Likes