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

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

Asked by
MiguRB 60
5 years ago
Edited 5 years ago

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

Log in to vote
1
Answered by
OnaKat 444 Moderation Voter
5 years ago

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
0
Okay, thanks for your advice! :) MiguRB 60 — 5y
Ad

Answer this question