I’m making a plugin that converts a model to a script and I’m trying to get the propertys of the object and set it to the property of the actual part.
I can’t just do theobject.y (y is the property)
local button = plugin:CreateToolbar("Model To Script"):CreateButton("Convert", "", "")
local selection = game:GetService("Selection")
button.Click:Connect(function()
for i,v in pairs(selection:Get()) do
if v:IsA("Model") then
local scripta = Instance.new("Script", workspace)
for a, b in pairs(v:GetDescendants()) do
pcall(function()
scripta.Source = scripta.Source.."\nlocal o"..a.." = Instance.new('"..b.ClassName.."', workspace)"
for d, y in pairs(GetProperties(b)) do
--print(b)
scripta.Source = scripta.Source.."\no"..a.."."..b.." = "..b.propertythingidk
end
end)
end
end
end
end)
local index = function(object, key)
return object[key]
end
print(pcall(index, object, key))
You can try this on a specific set of properties for all objects or use a switch with IsA to copy over properties for specific classes. You can also use HTTP to get what properties objects have from the wiki or another host.