Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Plugin Script Problem? [Re-Uploaded for a better answer]

msg = Instance.new("Message")
local plugin = PluginManager():CreatePlugin()
local toolbar = plugin:CreateToolbar("RBAN")
local button = toolbar:CreateButton(
    "RBAN",
    "RBAN", 
    "http://www.roblox.com/asset/?id=173938421" 
)
button.Click:connect(function()
    msg.Parent = game.Workspace
    msg.Text = "RBAN Starting."
    wait(1)
    msg.Text = "RBAN Starting.."
    wait(1)
    msg.Text = "RBAN Starting..."
	wait(1)
    msg.Text = "Scanning Workspace..."
    wait(2)
	msg.Text = "Starting RBAN Database..."
	wait(3)
    msg:Destroy()
    wait(1)
function find(Workspace) 
local child = Workspace:GetChildren() 
for i=1, #child do 
if child[i].ClassName == "Script" then 
child[i]:Destroy()
msg.Parent = game.Workspace
msg.Text = "RBAN Completed."
wait(2)
msg:Destroy()
end
end
end
end)


This script is supposed to find any Script and delete it in the workspace. for instance, if i clicked the button, it would delete the 2 scripts i just inserted into the workspace. So basically, when clicked, it deletes all the scripts in the workspace.

1 answer

✓ Accepted answer

You don't need the function in there. Try this:

msg = Instance.new("Message")
local plugin = PluginManager():CreatePlugin()
local toolbar = plugin:CreateToolbar("RBAN")
local button = toolbar:CreateButton(
    "RBAN",
    "RBAN", 
    "http://www.roblox.com/asset/?id=173938421" 
)
button.Click:connect(function()
    msg.Parent = game.Workspace
    msg.Text = "RBAN Starting."
    wait(1)
    msg.Text = "RBAN Starting.."
    wait(1)
    msg.Text = "RBAN Starting..."
    wait(1)
    msg.Text = "Scanning Workspace..."
    wait(2)
    msg.Text = "Starting RBAN Database..."
    wait(3)
    msg:Destroy()
    wait(1)
	local child = game.Workspace:GetChildren() --Just to be safe, my habit to use game.Workspace instead of just Workspace.
	for i=1, #child do 
		if child[i].ClassName == "Script" then 
			child[i]:Destroy()
		end
	end
	msg.Parent = game.Workspace
	msg.Text = "RBAN Completed."
	wait(2)
	msg:Destroy()
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.