Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Find Model size using script?

Asked by
ZeroBits 142
10 years ago

How do You find a model's size? I have no idea where to start on this one, I need it for a script that only let's You insert models under a certain size limit.

Also, is it possible to check the model's size without inserting it?

1 answer

Log in to vote
1
Answered by 10 years ago

So lets create a completely random model, just for an example:

local model = Instance.new('Model', Workspace)  --Makes our model

for i = 1, 20 do
    local part = Instance.new('Part', model)  --Creates a part
    part.Anchored = true
    part.Size = Vector3.new(math.random(1,50), math.random(1,50), math.random(1,50))  --Random size
    part.Position = Vector3.new(math.random(1,50), math.random(1,50), math.random(1,50))  --Random positions
end

We have no clue what the size of the model is, so you can try this at the end of that script:

print(model:GetModelSize())

Give it a shot, and let me know if I need to elaborate.

0
You mean there's a GetModelSize Function? I'm laughing so much Right now, I didn't check to see if there was a pre-loaded function. ZeroBits 142 — 10y
0
Lol, it's ok. People underestimate the methods of models all the time. I didn't even know TranslateBy() existed until I looked it up! DiamondBladee 135 — 10y
Ad

Answer this question