Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to set a parts position after you resize them? [Not Solved]

I wanted to resize all the brick in a model, but want them in the original position they're currently in. Here's the logical process. 1. Take its current value and store it somewhere. 2. resize the brick(And it'll move due to collision check. Keep in mind all bricks are anchored)3. Move the brick in its original position. All that to say, what am I doing wrong? It wont go to its original position. I tried CFrame but it loses its rotational values.

local g = script.Parent["plane.028_plane.018"]:GetChildren()
	for i=1, #g do
	local Stance = Instance.new("Vector3Value",g[i])
		Stance.Name = "Vector"
		Stance.Value = g[i].Position
		g[i].Size = g[i].Size + Vector3.new(4.8,0,0)
		g[i].Position = g[i].Vector.Value
		end

2 comments

0

Do you want to scale a model, or do you want to shrink the individual Parts of a model but keep them in their previous absolute position? (Not positioned relative to the new sizes of the other Parts)

0

I wanted to shrink the individual parts. and keep them in their previous position

1 answer

for _, v in pairs(script.Parent["plane.028_plane.018"]:GetChildren()) do
	--v will be the part
	local position = v.Position
	v.Size = v.Size + Vector3.new(4.8,0,0)
	v.Position = position
end

Cannot test this since I'm at school, best of luck and if this doesn't work then reply with error message

4 comments

0

Already tried that. Didnt work :c

0

Oh alright... What happened when you did that?

0

Same exact thing. Parts resized but didn't move back to their positions.

0

Instead of v.Position do v.CFrame and local position = v.CFrame

This discussion is preserved as it was. New answers, comments, and votes are closed.