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

X cannot be assigned to? Not changing my parts X and Z size to another part's X and Z size..?

I'm trying to make a part that sets it's X and Y size to another part's X and Y size.

local buildings = workspace.Buildings:GetChildren()

local roofs = Instance.new("Folder", workspace)

for i = 1,#buildings do
	local roof = Instance.new("Part", roofs)

	roof.Size.X = buildings[i].Size.X
	roof.Size.Z = buildings[i].Size.Z
end

Error = X cannot be assigned to

Why isn't it changing the X and Z size of the part to the X and Z size of the building[i]? Any help or tip appreciated !

1 answer

✓ Accepted answer

You can't change only X,Y or Z. Use Vector 3 to set the size.

local buildings = workspace.Buildings:GetChildren()

local roofs = Instance.new("Folder", workspace)

for i = 1,#buildings do
	local roof = Instance.new("Part", roofs)
	roof.Size = Vector3.new(buildings[i].Size.X,roof.Size.Y,buildings[i].Size.Z)
end

1 comment

0

Okay, thanks for your advice! :)

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