Hello there, I am getting an error message that says
“cloud_9038237548.Script:16: attempt to call a nil value”
I do not know much about scripting so making this script required me to do a lot of internet surfing mainly using the Roblox Developer Hub and the DevForum.
I am making this script for a Plugin so that I am able to remove all of the “Welds” and “Snaps” located in the workspace, the reason I cannot do this manually is that there is over 300 total which would take me forever to delete everyone.
This is what I am getting in my Output:
Script:
local toolbar = plugin:CreateToolbar("Remove Welds") -- Name
local PluginButton = toolbar:CreateButton("Remove Welds", "Removes all Welds located in the Workspace.", "rbxassetid://4989743062") -- Name : Desc : Icon
PluginButton.ClickableWhenViewportHidden = true
local function onPluginButtonClicked()
print("Plugin Button Clicked") -- Print a message when Plugin button is clicked.
local classesToRemove = {
["Weld"] = true,
["Snap"] = true,
}
for n, descendant in pairs(workspace:GetDescendants()) do
if classesToRemove[descendant.ClassName] then
classesToRemove:Destroy()
print("All Welds located in Workspace has now been deleted.") -- Print a message when Welds are deleted.
end
end
end
PluginButton.Click:Connect(onPluginButtonClicked)