Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Gui script help?

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

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)

2 comments

0

Hey, I just tried this in-game and it didn't work. Did it work for you?

1

Try checking your hierarchies, they might be incorrect.

This discussion is preserved as it was. New answers, comments, and votes are closed.