I am trying to create my first plugin for Roblox Studio and I want to know how to make a table of all of the selected objects once the button is clicked.
I need to make a for i,v in ipairs(selected) do
loop with the selected table containing the definitions of the selected objects in studio.
1 Like
local Selection = game:GetService("Selection")
for index, value in ipairs(Selection:Get()) do
print(value.Name)
end
1 Like
local toolbar = plugin:CreateToolbar("ZFight Fixer")
local pluginButton = toolbar:CreateButton(
"ZFight Fix",
"Remove Z-Fighting from Selected Parts",
"rbxassetid://12654122093"
)
pluginButton.Click:Connect(function()
local selection = game:GetService("Selection")
local a = 1
for i, v in pairs(selection:Get()) do
v.Size = Vector3(v.Size.X-(0.001*a),v.Size.Y-(0.001*a),v.Size.Z-(0.001*a)) -- line 13
a=a+1
end
end)
When selecting multiple parts and pressing the button, it errors on line 13, saying attempt to call a table value
You have Vector3( ... )
on line 13. You forgot .new
Of course it’s a brain turning off moment. Thanks!
1 Like
No worries! Could you do me a favor and mark his post as the solution though? The reason being, solutions are not designed to give credit or prestige to the people who came up with the answer, they’re intended to highlight whatever answered the question. Since his reply is related to the original question (and mine is not) his solution will be more relevant to anyone in the future who finds this thread.
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.