generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Plugin button refuses to stay selected

Previous Thread :: Next Thread 
IHurtPeople is not online. IHurtPeople
Joined: 02 Aug 2011
Total Posts: 443
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
IHurtPeople is not online. IHurtPeople
Joined: 02 Aug 2011
Total Posts: 443
30 Aug 2011 02:15 PM
T_T

bump.
Report Abuse
IHurtPeople is not online. IHurtPeople
Joined: 02 Aug 2011
Total Posts: 443
30 Aug 2011 02:36 PM
ogm u guise suk
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
30 Aug 2011 02:41 PM
[ Content Deleted ]
Report Abuse
IHurtPeople is not online. IHurtPeople
Joined: 02 Aug 2011
Total Posts: 443
30 Aug 2011 02:45 PM
do you actually know how
Report Abuse
JulienDethurens is not online. JulienDethurens
Joined: 11 Jun 2009
Total Posts: 11046
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
IHurtPeople is not online. IHurtPeople
Joined: 02 Aug 2011
Total Posts: 443
30 Aug 2011 03:30 PM
um

couldn't you have just explained the error isn't of completely rewriting it
Report Abuse
JulienDethurens is not online. JulienDethurens
Joined: 11 Jun 2009
Total Posts: 11046
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
IHurtPeople is not online. IHurtPeople
Joined: 02 Aug 2011
Total Posts: 443
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
JulienDethurens is not online. JulienDethurens
Joined: 11 Jun 2009
Total Posts: 11046
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
IHurtPeople is not online. IHurtPeople
Joined: 02 Aug 2011
Total Posts: 443
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image