I made a dictionary consisting of types of objects and the properties I want to tween of each.
local uiDefs = {
["UIStroke"] = {"Transparency"},
["ImageLabel"] = {"ImageTransparency", "BackgroundTransparency"},
["TextLabel"] = {"TextTransparency", "BackgroundTransparency", "TextStrokeTransparency"}
}
I attempted to loop through the GuiObjects, check to make sure they are the correct class, and modify the properties. However, because the properties are strings within the table, it errors when attempting to use them as property names.
-- pre-defined vars "object" and "tweenInfo"
for name, defTable in pairs(uiDefs) do
if object:IsA(name) then
for _, prop in pairs(defTable) do
game:GetService("TweenService"):Create(object, tweenInfo, {prop = 1})
end
end
end
-- error: TweenService:Create no property named 'prop' for object 'Frame'
How can I modify the prop
variable to use it as a property name within propertyTable
?