Okay, so this script is supposed to basically wait until the Gui is visible, then wait 1 sec, and if the gui is still visible (this part will be critical eventually) close it and open the next one. It doesn't do anything. Please help me!
Here is the script:
player = game.Players.LocalPlayer gui = player.PlayerGui.ScreenGui loading = gui.loading results = gui.results while true do if loading.Visible == true then wait(1) if loading.Visible == true then loading.Visible = false results.Visible = true else script:Destroy() end else wait (1) end end
You can use .Changed event to run a function when the gui has any properties changed. There were a bit of unnecessary steps that you included in there as well. The script will only run the function when the loading gui is changed in any way and will only have an effect if it is visible when it is changed.
player = game.Players.LocalPlayer gui = player.PlayerGui.ScreenGui loading = gui.loading results = gui.results loading.Changed:connect(function() wait(1) if loading.Visible == true then loading.Visible = false results.Visible = true end end)