Here is the code I have

I made a plugin and for some reason the loader is inserting when I start studio when only the require script is suppost to when a button is pressed can you help?

-- Uploaded Message
print("REG Loader Plugin loaded")


-- Toolbar Setup
local toolbar = plugin:CreateToolbar("REG Plugins")

-- Variables
debounce = false
really = false

-- Button Setup
local button = toolbar:CreateButton(
	"Insert REG",
	"Inserts REG Lea into your game",
	"http://www.roblox.com/asset/?id=828747622"
)

if game.StarterGui:FindFirstChild("Loader") ~= nil then
	game.StarterGui.Loader:Destroy()
else
	really = true
end


button.Click:connect(function()
	if game.StarterGui:FindFirstChild("Loader") ~= nil then
 		game.StarterGui.Loader:Destroy()
    else
		really = true
    end
	q = game.ServerScriptService:FindFirstChild("REG Lea | Loader")
	if q ~= nil then
		t = script.Parent.error:Clone()
		t.Parent = game.CoreGui
		debounce = true
		plugin:Activate(false)
		wait(4)
		t:Destroy()
	else
		plugin:Activate(true)
		local h = script.Parent.Lo:Clone()
		h.Name = "REG Lea | Loader"
		h.Parent = game.ServerScriptService
		b = script.Parent.success:Clone()
		b.Parent = game.CoreGui
		wait(4)
		plugin:Activate(false)
		b:Destroy()
	end
end)

It works but for some reason every time I try to enter studio it inserts the loader that is required within the script that is suppost to be inserted into ServerScriptService

Link to Plugin: https://www.roblox.com/library/852931945/REG-Loader-Insert

Please help!

2 comments

0

I'm sorry but you were kinda confusing. Can you edit and be a bit more clear?

0

I think you have to add the mouse:click()