Hack-ishly tweening models size and position

With the beta release of ToScale, I was able to create a smoothly scaling system for models. This, along with my other ways for tweening fully anchored models, I was able to create a hackish system for tweening models.

It has no fancy options and isn’t performant as I’d like it to be but for my use case of it being completely on the client and the fact that I’ll only be using it for one model at a time, it’s pretty much perfect.

Also, for those who would greatly benefit from the tweening of models, there may be some hope:

Reminder that the choppy updates aren’t from my code but from my inability to create seamless GIFs.

A couch model that has earned the ability to float.

Same model but it changes scale.

The same model but it does both!

I’m going to be using this code to create a smooth feeling plot builder. Instead of editing your plot with gross dev tools that lock the object to a 1x1 grid, it’ll smoothly “tween” itself to its new position or scale, and soon orientation.

Any feedback?

1 Like

Tweening of a classic.

If anyone wants to accomplish something similar, all you have to do is:

  1. Set a primary part to your model and weld all other parts to it (Keep all parts unanchored except for the primary part)
  2. Create a Number Value that we can tween
  3. Create a function that will listen every time the value gets changed
  4. Use ToScale() to replicate the updated value changes to the model’s scale

Code Example:

-- Create a Model (Can be parented anywhere, but this example is Replicated Storage)
local Model = game:GetService("ReplicatedStorage"):WaitForChild("Model")
local modelClone = Model:Clone()
local Primary = modelClone.PrimaryPart
modelClone.Parent = workspace

-- Create a Number Value to Tween
local numValue = Instance.new("NumberValue")
numValue.Parent = modelClone
numValue.Value = modelClone:GetScale() -- Get's Model's current Scale located in it's properties

-- Create a part and set CFrame with your desired ending position of your model
local targetPosition = workspace.EndPosition.CFrame 
local targetScale = 1 -- 1 = 100% of the model's size (So 2 would be 200% etc.)

-- Create the Tweens
local tweenInfo = TweenInfo.new(5,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut)
TS:Create(Primary,tweenInfo,{CFrame = targetPosition }):Play() -- This tween MOVES the MODEL by tweening the PrimaryPart's CFrame
TS:Create(numValue,tweenInfo,{Value = targetScale }):Play() -- This tween CHANGES the VALUE of the Number Value we created earlier

-- Create a Function to listen for the Number Value being changed
numValue.Changed:Connect(function(value)
	Model:ScaleTo(value) -- Change the Model's Scale every time the Value updates (from tween)
end)

This will scale everything in the model simultaneously including particle emitters which is nice.

17 Likes

how do u only make it change size and not position

Remove the tween that changes its CFrame.