Issue with making a gui visible and disabled after a button click

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? So i am trying to make a script that close and opens a gui however it seems to not working.

  2. What is the issue? The gui will not show or disappear or show

Here is a picture

  1. What solutions have you tried so far? No actions just yet just asking you guys.

Anyone able to let me know in the comments.

Here is the game NetGames Super Racing 2.0 - Roblox

Code here!

script.Parent.MouseButton1Click:connect(function()
script.Parent.Parent.Credit.Visible = not script.Parent.Parent.Tracks.Visible
end)

I will also mention the script is located in the text!
image

In the image you showed, the “Credit” Frame is actually a child of a TextButton that is a child of the ScreenGui. So the Credit frame is not a direct child of ScreenGui. According to your error you are trying to index Credit as a direct child of your ScreenGui. The fix to this is by indexing it appropriately by looking at the path of the object.

Hello i changed some of the script i don’t think this will work but i will give it a try.

script.Parent.Parent.ScreenGui.Tracks1.Tracks.Visible = not script.Parent.Parent.ScreenGui.Tracks1.Tracks.Visible
end)

I hope this helps…

Don’t worry fixed it!

thanks for the support.