Please do, I don’t know why but I just can’t do open and close gui’s.
I have edited my code, try it again?
You’re always setting the gui to visible. Try this instead:
local openbutton = script.Parent
local Gui = script.Parent.Parent.Parent.SettingsFrame
openbutton.MouseButton1Click:Connect(function()
Gui.Visible = not Gui.Visible;
end)
Does not work, only opens but I want the same button to close and open.
local openbutton = game.StarterGui.ScreenGui.Settings.ImageButton
local Gui = game.StarterGui.ScreenGui.SettingsFrame
openbutton.MouseButton1Click:Connect(function()
if Gui.Visible == true then
Gui.Visible = false
else if Gui.Visible == false then
Gui.Visible = true
end
end
end)
Does not work, thanks for trying though.
What error are you getting?
Check the console.
Can you invite me to the studio again?
It gives me no errors but does not work.
You are still in studio so just look on games shared with me.
The local script is inside of the image button, right?
You have to accept the friend request again
Yep, it’s inside the Image Button.
Ok, I will right now. [30 LIMIT[
Check now, I have added you back to the project.
Remember to use Player.PlayerGui instead of game.StarterGui
Here is the correct code:
local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local openbutton = PlayerGui.ScreenGui.Settings.ImageButton
local Gui = PlayerGui.ScreenGui.SettingsFrame
openbutton.MouseButton1Click:Connect(function()
Gui.Visible = not Gui.Visible
end)
Okay, so.]
In your textbutton you need to insert a LocalScript.
in the localscript, write this:
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Frame.Visible = true – Change the ‘Frame’ to whatever the name of the frame is that you want to appear.
Then you need to make a close button!!!
Put it inside the frame that opened and insert a local script and write this:]
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Visible = false
It’s pretty similar.
I’m only giving you the full script because this is easy to resolve, but if you want more complicated script your gonna have to find it out without people feeding you all the information and scripts.
Anyways, hope it helps
stay safe
happy halloween
local gui = -- gui location
local button = -- button location
button.MouseButton1Click:Connect(function() -- click function
gui.Visible = true -- visible
if gui.Visible == true then -- if it's already visible then
gui.Visible = false -- invisible
end
end)
Or you can use gui.Enabled
instead of gui.Visible
.
here is a more compact way of doing it with 1 button
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Frame.Visible = not script.Parent.Parent.Frame.Visible
end)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.