Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Gui script help?

Asked by 9 years ago

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

1 answer

Log in to vote
2
Answered by 9 years ago

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)
0
Hey, I just tried this in-game and it didn't work. Did it work for you? Antharaziia 75 — 9y
1
Try checking your hierarchies, they might be incorrect. FearMeIAmLag 1161 — 9y
Ad

Answer this question