Model becomes bigger by 1 stud every second | Error

Hello Developers!

I am fairly new to scripting and I wanted to try something. I tried to make a script that would resize the noob by 1 stud every second until it gets to 100. The limbs of the noob is just in one model called “Noob”. I cant find a way to make the model bigger by 1 stud a second. So far I haven’t been able to make it work.

local model = workspace.Noob
local x = 0
while x < 100 do
x = x +1
model.Size = Vector3.new(x, x, x) -- Size is not a valid member of Model "Workspace.Noob"
		wait(1)
	if x == 100 then
		break
	end
end

Thank you so much!

-Skull

You’ll need to resize and move every part individually, because models don’t have a size property. And I believe that the model’s size shouldn’t be the same on every axis.

Are the parts of the noob anchored or are they attached to eachother with joints like welds or motor6ds?

1 Like

The parts of the noob are anchored. No welds.

Models don’t have a size property.

local x = 0
while x < 100 do
    x = x + 1
    for i, v in pairs(model:GetChildren()) do
        if v:IsA("Part") then
            v.Size = Vector3.new(x, x, x)
            wait(1)
            if x == 100 then
                break
            end
        end
    end
end


You’ll need to loop through each child of the model and then size it.

1 Like

@cshszn is right but here is how I would do it:

I wouldn’t do a while loop for this, but instead a for do loop

for x = 1, 100 do -- x starts at 1 and it loops until x is equal to 100
        for _, part in pairs(model:GetChildren()) do
	        if part:IsA("Part") then
        	       model.Size = Vector3.new(x,x,x)
	        end
    wait(1)
end

x is the index variable so you do not have to define it before the loop.

Hope this helps!

1 Like

This should change the model’s height by one stud every second and scale it on other axes too, without changing the proportions.

local model = workspace.Noob
local parts = model:GetChildren()

local cf, size = model:GetBoundingBox()
local bottomCf = cf-Vector3.new(0, size.Y*.5, 0)

local function resize(scale)
	for i, v in ipairs(parts) do
		v.Position = bottomCf*(bottomCf:PointToObjectSpace(v.Position)*scale)
		v.Size *= scale
	end
end

resize(1/size.Y)
for height = 2, 100 do
	wait(1)
	resize(height/(height-1))
end
1 Like