How do i connect the button to the rest of the script ?
self = PluginManager():CreatePlugin()
toolbar = self:CreateToolbar("Roblox Defender")
toolbarbutton = toolbar:CreateButton("Realtime Protection", "Activate", "Plug-Ins Picture (This can be blank, I will explain later on this page.)")
toolbarbutton.Click:connect(function()
local LightingLock = false -- True will prevent any lighting changes, or adding skyboxes in-game (skyboxes saved to the game will stay). Will prevent Time of Day scripts and similar from working.
-- Virus Protection:
local Antivirus = {Enabled = true, Names = {"virusname"}} -- If something is added to Workspace, it will be removed if its name is in this table. Not caps sensitive.
-- Additional Features:
local WhiteList = {Enabled = false, WhiteListedUsers = {"Player1"}} -- Enabled whitelist only allows people with their names in the table to join the game.
-- Do not edit below this point if you do not know what you are doing --
local ActiveProtectChest
if not game.ServerStorage:FindFirstChild("Realtime Protection Quarantine V.1") then
ActiveProtectChest = Instance.new("Folder", game.ServerStorage)
ActiveProtectChest.Name = "Realtime Protection Quarantine V.1"
else
ActiveProtectChest = game.ServerStorage:FindFirstChild("Realtime Protection Quarantine V.1")
end
-- 1. Lighting Lock
game.Lighting.ChildAdded:connect(function(Instance)
if LightingLock then
if Instance.ClassName == "Sky" then
wait()
Instance.Parent = ActiveProtectChest
end
end
end)
local Lighting = game:GetService("Lighting")
local LightingNames = {"Ambient","Brightness","ColorShift_Bottom","ColorShift_Top","GlobalShadows","OutdoorAmbient","Outlines","ShadowColor","GeographicLatitude","TimeOfDay","FogColor","FogEnd","FogStart"}
local LightingProperties = {Lighting.Ambient,Lighting.Brightness,Lighting.ColorShift_Bottom,Lighting.ColorShift_Top,Lighting.GlobalShadows,Lighting.OutdoorAmbient,Lighting.Outlines,Lighting.ShadowColor,Lighting.GeographicLatitude,Lighting.TimeOfDay,Lighting.FogColor,Lighting.FogEnd,Lighting.FogStart}
Lighting.Changed:connect(function()
if LightingLock then
for i,v in pairs(LightingNames) do
Lighting[v] = LightingProperties[i]
end
end
end)
-- 2. Basic Virus Protection. Not in-depth as Workspace Scan in the Plugin.
game.Workspace.DescendantAdded:connect(function(Instance)
if Antivirus.Enabled then
for i, v in pairs (Antivirus.Names) do
if string.lower(Instance.Name) == string.lower(v) then
wait()
Instance.Parent = ActiveProtectChest
end
end
end
end)
-- 3. White List
game.Players.PlayerAdded:connect(function(Player)
if WhiteList.Enabled then
local PlayerAllowed
for i, v in pairs (WhiteList.WhiteListedUsers) do
if Player.Name == v then
PlayerAllowed = true
break
end
end
if not PlayerAllowed then
Player:Kick("You are not whitelisted on this server.")
end
end
end)

1 comment
We no longer use PluginManager to create plugins, here is a more up-to-date turorial http://wiki.roblox.com/index.php?title=Tutorial:Plugins. You can just use the "plugin" variable in server scripts.