Is it possible to make a GUI that, when pressed, activates a bunch of billboard guis, then when clicked again they will go invisible.
If anyone knows how to make something like that please let me know.
Is it possible to make a GUI that, when pressed, activates a bunch of billboard guis, then when clicked again they will go invisible.
If anyone knows how to make something like that please let me know.
Let me test something out
Do what you need to do, godspeed.
local Billboards = workspace.Billboards -- Location of the billboards
local button = script.Parent -- The button
local Open = false -- Debounce
button.MouseButton1Click:connect(function()
if Open == false then -- If the debounce is false (Closed)
Open = true -- Make it true (Open)
for _, v in ipairs(Billboards:GetChildren()) do -- Gets the Billboards variable children
v.Enabled = true -- Changes all them to be enabled
end
else -- The below code basically does the opposite of above
Open = false
for _, v in ipairs(Billboards:GetChildren()) do
v.Enabled = false
end
end
end)
I have my billboards located in workspace using Adornee which you can read about here if you don’t know how to use it
http://wiki.roblox.com/index.php?title=API:Class/BillboardGui – This includes the other billboard Gui properties as well
That should work
Thank you very much, I have a question about this, is that script supposed to be in a gui or in the workplace.
In a textbutton in a gui, is what I did it in. But you can change this easy.
I tried that but when I click the GUI the Billboard gui doesn’t disappear.
Did I do something wrong?
local Billboards = workspace.Billboards -- Location of the billboards
local button = script.Parent -- The button
local Open -- when you declare a variable, it sets the value to nil
button.MouseButton1Click:connect(function()
Open = not Open -- Make Open the opposite of what it currently is (nil -> true, true -> false, false -> true)
for _, v in pairs(Billboards:GetChildren()) do -- Gets the Billboards variable children
v.Enabled = Open -- Changes all of them to what open is
end
end)
you can clean that up quite a bit (it’s the same code, but less lines)
Also, you shouldn’t be using scripts in the playergui, only localscripts. The playergui runs on the client; scripts are server sided. (it’ll work in play solo, but not in a live game)
Your problem as to why it isn’t working is that the folder in the workspace isn’t named “Billboards”, that’s what the first line the script looks for.
Yeah, I used a local script c:
Thank you it worked!