So I honestly suppose this is broken because I am bad at scripting. I tried but clearly it doesn't work :P
So I have this 'Menu' GUI, with two invisible GUIs below it. I intend so that when I click on the Menu button, the two GUIs below it, Donate and Information, will become visible, and of course clickable. I suppose it's because I'm confused on how MouseButton1Down works.
If you need this AT ALL: http://prntscr.com/74k68o
My current scripting that I attempted:
print("Menugui dropdown-initiate") MenuHeader = game.StarterGui.ScreenGui.Frame.MenuHeader Donate = game.StarterGui.ScreenGui.Frame.Donate Info = game.StarterGui.ScreenGui.Frame.Information function Dropdown() MenuHeader.MouseButton1Click:connect(Dropdown) Info.Visible = true Donate.Visible = true MenuHeader.MouseButton1Click:connect(Dropdown) Info.Visible = false end script.Parent.MouseButton1Down:connect(Dropdown)
I would appreciate if you could help me out. Thanks!
function Dropdown() MenuHeader.MouseButton1Down:connect(Dropdown) end
This part causes the script to flip out. You have an event that fires when you click a button, but inside of the function, is the same exact event.
So, what the script is doing is this
function Dropdown() Dropdown() end Dropdown()
It's causing a loop, that's why it doesn't become visible. Imagine your code like this
while true do wait(1) print("You'll never destroy me!") end script:Destroy()
It will never get to the line with :Destroy() because the while loop doesn't end.
When attempting to change a GUI for a user, you will need to access the GUIs through their PlayerGui object. When changing a GUI through StarterGui, the GUI won't appear changed until you reset and it will be changed for everybody. In order to fix this, please use a LocalScript and access their PlayerGui throguh game.Players.LocalPlayer.PlayerGui
. If you have any other questions, feel free to ask me.
Try this
MenuHeader = script.Parent.Frame.MenuHeader Donate = script.Parent.Frame.Donate Info = script.Parent.Frame.Information
insted of the old things I can make the GUI for you if you want just give me a model.