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

Help trying to learn how to change the coordinates of an item after resizing?

Asked by 5 years ago

Hello, and thank you in advance for any help provided. I recently asked a question about changing the size of all parts under a workspace's parent folder. This code below works perfect!

for i,v in pairs(workspace.SpecialParts:GetChildren()) do
    if v:IsA("BasePart") then
        v.Size = Vector3.new(10,10,10) 
    end
end

But I realized I need to change the parts location too. I already have the XYZ coordinates but I am confused how to input it into the code above so it changes both the size and coordinates of 'part'. Instead of just the part size. Any help is greatly appreciated.

Thanks a ton!

1 answer

Log in to vote
0
Answered by
Aznarog 54
5 years ago
Edited 5 years ago

For the parts location you need to change the Position of the part. The Position of a part is also a vector3, and since you have the X,Y,Z Co-ordinates, it's simply:

for i,v in pairs(workspace.SpecialParts:GetChildren()) do
    if v:IsA("BasePart") then
        v.Size = Vector3.new(10,10,10) 
    v.Position = Vector3.new(X,Y,Z) -- position
    end
end
0
Works, thanks a ton for all the help. This is exactly what I needed. PieBoots 16 — 5y
0
No Problem! Aznarog 54 — 5y
Ad

Answer this question