I’m working on a Space - Exploration game and am looking for ways to Tween the size of a Model.
Why?
The game will feature ‘Hyper-space’ and I’m looking to make Planets “grow” when arriving at the destination; giving off the illusion they’ve come into range.
I know I can simply :Tween a single Part to grow to the required size, however - I’m looking to do this for a model; that way the Atmosphere surrounding the core retains the same increments etc.
I’m looking at @Crazyman42 resize script:
Though, instead of using * to determine an increment, I wish to have it as two points -
- Not in range (Shrunk and not visible. I.E. vector3.new(.05, .05, .05))
- in-range (Planets actual size. I.E. Value within Planet: vector3.new(100, 100, 100))
function ScaleModel(model, scale)
local primary = model.PrimaryPart
local primaryCf = primary.CFrame
for _,v in pairs(model:GetDescendants()) do
if (v:IsA("BasePart")) then
v.Size = (v.Size * scale)
if (v ~= primary) then
v.CFrame = (primaryCf + (primaryCf:inverse() * v.Position * scale))
end
end
end
return model
end
ScaleModel(game:GetService("Workspace"):WaitForChild("Planet"), 1)