Hi, I am having problems with my plugin, I can’t figure out how to do anything with the parts i have selected on my plugin, here is a section of the code:
--updateconfig
spawn(function()
while wait(1) do
current = selection:Get()
for i, v in ipairs(current) do
local convertedString = tostring(current[i])
SelectedPart.Text = "Part: ".. convertedString
end
end
end)
--funcs
RotateAdd.MouseButton1Down:Connect(function()
current:Destroy()
end)
Everything here but current:Destroy() works perfectly, i know that current is a array but I don’t know how I should get the object selected instead of a string array.
Any help would be extremely appreciated, thanks.
note: selection is fromlocal selection = game:GetService("Selection")
current is a table of Instance. Destroy is a method of a single instance. You can only call Destroy on an instance – not a table. You will need to iterate through every instance in the table and destroy each one.
Just found out the awnser!
I had to make another variable which unpacks current and then can be destroyed
also i was wrong about selection being a string table, it is really an instance table: local ctable = unpack(current)