|
| 30 Aug 2011 01:35 PM |
plugin = PluginManager():CreatePlugin() toolbar = plugin:CreateToolbar("SVSE") button = toolbar:CreateButton("", "", "icon.png") on = false function click(bon) on = bon print(on) button:SetActive(on) if on then print("active plugin") plugin:Activate() s.Parent = game:GetService("CoreGui") else s.Parent = nil end end button.Click:connect(function () click(not on) end) plugin.Deactivation:connect(function () click(false) end) s = Instance.new("ScreenGui") sf = Instance.new("Frame") sf.Size = UDim2.new(1, 0, 1, 0) sf.Position = UDim2.new(0, 0, 0, 0) sf.Parent = s
Basically makes a GUI appear and cover the screen when you hit the button and remove it when you hit the button again or select a different plugin - for some reason I can't fathom the button won't select
halp |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
|
| 30 Aug 2011 03:28 PM |
local self = PluginManager():CreatePlugin() local Toolbar = self:CreateToolbar 'SVSE' local Button = Toolbar:CreateButton("", "", 'icon.png') local CoreGui = game.CoreGui
local on = false
function Activate() if on then return end Button:SetActive(true) self:Activate() GUI.Parent = CoreGui on = true end
function Deactivate() if not on then return end Button:SetActive(false) GUI.Parent = nil on = false end
self.Deactivation:connect(Deactivate)
GUI = Instance.new 'ScreenGui'
Window = Instance.new('Frame', GUI) Window.Size = UDim2.new(1, 0, 1, 0)
Button.Click:connect(function() if on then Deactivate() else Activate() end end) |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2011 03:30 PM |
um
couldn't you have just explained the error isn't of completely rewriting it |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2011 03:33 PM |
| I don't know what the error was, I just knew that, by rewriting it, not only would it look better and be more organized, as well as more efficient, but that it'd also fix the error. =) |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2011 03:39 PM |
OGMLOLNVM
I fixed it - turns out that selecting the button before it's activated has no effect
I just moved the "SetActive" line to the end of the function and it worked
LOolOOlLOlOlllOLlOlOlOlOolOl |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2011 03:44 PM |
I guess this is the fixed version, then:
local self = PluginManager():CreatePlugin() local Toolbar = self:CreateToolbar 'SVSE' local Button = Toolbar:CreateButton("", "", 'icon.png') local CoreGui = game.CoreGui
local on = false
function Activate() if on then return end Button:SetActive(true) GUI.Parent = CoreGui on = true end
function Deactivate() if not on then return end Button:SetActive(false) GUI.Parent = nil on = false end
self.Deactivation:connect(Deactivate)
GUI = Instance.new 'ScreenGui'
Window = Instance.new('Frame', GUI) Window.Size = UDim2.new(1, 0, 1, 0)
self:Activate()
Button.Click:connect(function() if on then Deactivate() else Activate() end end) |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2011 03:55 PM |
i thought i implied that i only wanted a minor fix and not a complete rewrite but ok
threadclosedthx |
|
|
| Report Abuse |
|
|