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

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

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

✓ Accepted answer

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

2 comments

0

Works, thanks a ton for all the help. This is exactly what I needed.

0

No Problem!

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