Such a simple script but I get the error: Descriptions 1 is not a valid member of frame.
script.Parent.Parent.Parent.Descriptions1.Back.MouseButton1Down:connect(function() script.Parent.Parent.Parent.Descriptions1.Visible = false end)
This is in the local script: http://prntscr.com/aotuue
And the ButtonOne is in the Page 6: http://prntscr.com/aotux1
And in the Descriptions1: http://prntscr.com/aotwfl
I might be going mad, but I cannot work out what is wrong lol! :/
Thanks to anyone who can help :)
When you are dealing with GUIs, there is no real reason to go with the long parent chains. They are hard to read and easy to mess up. Rather, access the GUI through local player's PlayerGui.
And if you aren't using local script for this yet, then you should switch to it already. UI is completely client based, so it should be controlled only by local script.
local player = game.Players.LocalPlayer local descriptionUI = player.PlayerGui.YOURGUI.PathToDescriptions1 descriptionUI.Back.MouseButton1Down:connect(function() descriptionUI.Visible = false end)
If you didn't know yet, the local script is code that would get ran exactly on player's computer, while regular script runs only on the server. Since a localscript runs on each player's computer serperately, you can actually find out who is running the local script, via the game.Players.LocalPlayer
property.