so, im trying to make a plugin that opens a gui which has a few basic script templates (its for me to save me from typing every time i want to make a gui button), but its not working. when I click on it, it always says the screenguis parent is nil, or something else is nil, help?
line ten is where i get the error btw
tb = plugin:CreateToolbar("Basic Stuff")
bt = tb:CreateButton("Basic Stuff", "plugin", "http://www.roblox.com/asset/?id=76710160")
g = script:WaitForChild("basicgui")
s = game:GetService("Selection")
bt.Click:Connect(function()
if g.Parent == script then
script.success:Play()
g.Parent = game:WaitForChild("CoreGui")
g.main.BackgroundTransparency = 1
g.main.badge.BackgroundTransparency = 1
g.main.click.BackgroundTransparency = 1
g.main.loop.BackgroundTransparency = 1
g.main.tool.BackgroundTransparency = 1
g.main.touch.BackgroundTransparency = 1
for i = 1, 100 do
task.wait(0.01)
g.main.BackgroundTransparency -= 0.01
g.main.badge.BackgroundTransparency -= 0.01
g.main.click.BackgroundTransparency -= 0.01
g.main.loop.BackgroundTransparency -= 0.01
g.main.tool.BackgroundTransparency -= 0.01
g.main.touch.BackgroundTransparency -= 0.01
end
elseif g.Parent == game:WaitForChild("CoreGui") then
g.main.BackgroundTransparency = 0
g.main.badge.BackgroundTransparency = 0
g.main.click.BackgroundTransparency = 0
g.main.loop.BackgroundTransparency = 0
g.main.tool.BackgroundTransparency = 0
g.main.touch.BackgroundTransparency = 0
for i = 1, 100 do
task.wait(0.01)
g.main.BackgroundTransparency += 0.01
g.main.badge.BackgroundTransparency += 0.01
g.main.click.BackgroundTransparency += 0.01
g.main.loop.BackgroundTransparency += 0.01
g.main.tool.BackgroundTransparency += 0.01
g.main.touch.BackgroundTransparency += 0.01
end
g.Parent = script
end
end)
g.main.badge.MouseButton1Click:Connect(function()
if s then
g.success:Play()
local clo = g.main.scripts.badge:Clone()
clo.Parent = s
s:Set({clo})
else
g.unsuccess:Play()
end
end)
g.main.click.MouseButton1Click:Connect(function()
if s then
g.success:Play()
local clo = g.main.scripts.click:Clone()
clo.Parent = s
s:Set({clo})
else
g.unsuccess:Play()
end
end)
g.main.loop.MouseButton1Click:Connect(function()
if s then
g.success:Play()
local clo = g.main.scripts.loop:Clone()
clo.Parent = s
s:Set({clo})
else
g.unsuccess:Play()
end
end)
g.main.tool.MouseButton1Click:Connect(function()
if s then
g.success:Play()
local clo = g.main.scripts.tool:Clone()
clo.Parent = s
s:Set({clo})
else
g.unsuccess:Play()
end
end)
g.main.touch.MouseButton1Click:Connect(function()
if s then
g.success:Play()
local clo = g.main.scripts.touch:Clone()
clo.Parent = s
s:Set({clo})
else
g.unsuccess:Play()
end
end)
g.main.badge.MouseEnter:Connect(function()
g.hov:Play()
end)
g.main.click.MouseEnter:Connect(function()
g.hov:Play()
end)
g.main.loop.MouseEnter:Connect(function()
g.hov:Play()
end)
g.main.tool.MouseEnter:Connect(function()
g.hov:Play()
end)
g.main.touch.MouseEnter:Connect(function()
g.hov:Play()
end)