Script does not work

script:

local open = script.Parent

open.MouseButton1Click:Connect(function()

open.Visible = false

game.StarterGui.AnimationsGui.Enabled = true

end)

I am trying to make an open and close button for a gui, but I have no idea why it does not work.

Instead of game.StarterGui.AnimationsGui.Enabled = true. Try script.Parent or player.playergui.

1 Like
local player = game.Players.LocalPlayers

local open = script.Parent

open.MouseButton1Click:Connect(function()

open.Visible = false

plr.playergui.AnimationsGui.Enabled = true



end)
1 Like

where do I put the open button?

If the button is already in a screengui. All you need to do is affect the playergui. quick process.

1 Like

use playergui instead, affeting starter wont do anything (i think

1 Like

Or you could just do a easy easy easy script
a local script inside of the button and put

script.Parent.MouseButton1Click:Connect(function()
	if script.parent.parent[parent until you see your frame or GUI].Visible OR Enabled == false OR true then
script.parent.parent[parent until you see your frame or GUI].Visible OR Enabled = false OR true
end)

very bad explaining, ill just drop an example of my button and you remake it

script.Parent.MouseButton1Up:Connect(function()
	if script.Parent.Parent.Parent.RANK.Visible == false then
		script.Parent.Parent.Parent.RANK.Visible = true
	end
end)

--- IF ITS A GUI THAT YOU'RE TRYING TO DISABLE/ENABLE

script.Parent.MouseButton1Up:Connect(function()
	if script.Parent.Parent.Parent.Parent.Title.Enabled == false then
		script.Parent.Parent.Parent.Parent.Title.Enabled = true
	end
end)
1 Like

Actually, i got bored and made a cool close/open GUI for you

(There is no design of course)

EXAMPLE OF HOW IT LOOKS

1 Like

god, so many replies for nothing. there you go :upside_down_face: (ur starter gui in the image u sent doesnt look like its matching to the script so that may be why

local player = game:GetService("Players").LocalPlayer
local PlayerGui = player.PlayerGui
script.Parent.MouseButton1Click:Connect(function()
     if script.Parent.Visible == true then
          script.Parent.Visible = false
     end
     if PlayerGui:WaitForChild("AnimationsGui").Enabled == false then
          PlayerGui:WaitForChild("AnimationsGui").Enabled = true
     end
end)
3 Likes

lol they still don’t work. I’ll just look up some youtube videos on how to make these. But thanks guys for all the great help!

1 Like

What about my script lol

chars limit

1 Like

yes yours works but I need to watch some videos to configure it for my game or it might break the script lol

Hope this should fix your problems.

3 Likes

This line doesn’t make any sense.

1 Like

Just do script.Parent.Visible = not script.Parent.Visible

1 Like

If you make the script’s parent invisible or disable the ScreenGui the button is going to disappear. Which UI object do you want to close and open?1

depends, what if it is visible then why set it to what it is already