Hello guys, recently I’ve been trying to return all properties of an instance, but for some odd reason, I’m unable to put Color3.fromRGB
and UDim2
values inside a table. Whenever I try printing them, it shows three values and doesn’t display them in their usual format (e.g., 0,0,0
instead of UDim2.new(0,0,0)
).
Here’s my code
local function ReturnAllProperties(TheInstance)
local AllowedProperties = {
Size = UDim2.new(TheInstance.Size.X.Scale,TheInstance.Size.X.Offset,TheInstance.Size.Y.Scale,TheInstance.Size.Y.Offset) or nil,
Position = UDim2.new(TheInstance.Position.X.Scale,TheInstance.Position.X.Offset,TheInstance.Position.Y.Scale,TheInstance.Position.Y.Offset) or nil,
BackgroundTransparency = tonumber(TheInstance.BackgroundTransparency) or nil,
Rotation = tonumber(TheInstance.Rotation) or nil,
BackgroundColor3 = Color3.fromRGB(TheInstance.BackgroundColor3.R,TheInstance.BackgroundColor3.G, TheInstance.BackgroundColor3.B) or nil,
BorderColor3 = Color3.fromRGB(TheInstance.BorderColor3.R,TheInstance.BorderColor3.G,TheInstance.BorderColor3.B) or nil,
TextScaled = TheInstance.TextScaled or nil,
Font = TheInstance.Font.Name or nil,
Text = tostring(TheInstance.Text) or nil,
}
return AllowedProperties
end