How to set part properties using table?

Hi, Can anyone help me if possible, I’m new to table and I just want to set all the properties in my part. But I can’t do it. Why? I tried many ways but they gave me an error. The only solution I could find is Part.Material = Prop[2], but I don’t like it because if I need to set about 10 values, I will have to write Part. Size = Prop[1], Part. Position = Prop[2] and so on. Can there be a SetProperties or something similar? Please help.

local Part = game.Workspace:WaitForChild("Part")

local Properties = {
	Brickcolor = BrickColor.new("Really red"),
	Material = Enum.Material.Sand,
	Position =	Vector3.new(-54.4, 0.5, 22.5),
	Cframe = CFrame.new(25, 50, 10),
}

-- Part:SetProperties(Properties)?
7 Likes

Iterate over the table.

for Property, Value in pairs(Properties) do
    Part[Property] = Value
end
3 Likes

It works, thank`s you so much!