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

How do you make a Pop up GUI close it then open another?

So I'm trying to close a GUI than a few seconds or minutes later the other one pops up on the screen but I seem to not be able to do it can you please fix my script I'm kinda new at scripting.

[Script]

script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.FirstFrame.Visible == true then
	wait(5.0)
	script.Parent.Parent.FirstFrame.Visible = false
	 if script.Parent.Parent.FirstFrame.Visible == false then
		script.Parent.Parent.SecondFrame.Visible = true
		wait(5.0)
		script.Parent.Parent.SecondFrame.Visible = false
	end
end

end)

1 comment

0

hope it helped

3 answers

✓ Accepted answer

Untested, but probably will work.

script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.FirstFrame.Visible == true then
    wait(5)
    script.Parent.Parent.FirstFrame.Visible = false
    script.Parent.Parent.SecondFrame.Visible = true
    wait(5)
    script.Parent.Parent.SecondFrame.Visible = false
    end
end

OR

script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.FirstFrame.Visible == true then
    wait(5)
    script.Parent.Parent.FirstFrame.Visible = false
     if script.Parent.Parent.FirstFrame.Visible == false then
        script.Parent.Parent.SecondFrame.Visible = true
        wait(5)
        script.Parent.Parent.SecondFrame.Visible = false
    end
end
---you don't put decimals in your wait()

3 comments

0

ill test it thank you!

0

Adding on to LiLFriks, you dont have to check if the frame is visible to proceed with your next action, all you need to do is in the first if statement create a value with a boolean and at the beggining state that its false, and at the end that its true; then if the boolean is true that must mean the frame is no longer visible ; therefore, you can check using the variable. If you need me to explai

0

If you need me to explain I will post an explanation in answers

You need to use PlayerGui in order to access said goal. Which means the script must be a LocalScript in StarterPlayerScripts

local player = game.Players.LocalPlayer
local FirstFrame = player.PlayerGui:WaitForChild("ScreenGui"):WaitForChild("FirstFrame") -- Im assuming this is how it would go

local SecondFrame = player.PlayerGui:WaitForChild("ScreenGui"):WaitForChild("SecondFrame") -- Im assuming this is how it would go
local bool = true
if FirstFrame.Visible == true then
 bool = true
end

script.Parent.MouseButton1Click:Connect(function()
    if bool then
      wait(5)
       script.Parent.Parent.FirstFrame.Visible = false
      
     if not bool then
       script.Parent.Parent.SecondFrame.Visible = true

        wait(5)

        script.Parent.Parent.SecondFrame.Visible = false
      
end
end
end)
       

8 comments

0

Is it a local or just normal script?

0

Local Script

0

Ill check it okay

0

It seems to now have worked Should I show you what I put in

0

Absolutley fine

0

Not have wroked * I meant

0

Vincent that should work now

0

It seems to not work still

this what I put in

local player = game.Players.LocalPlayer local FirstFrame = player.PlayerGui:WaitForChild("ScreenGui"):WaitForChild("FirstFrame") -- Im assuming this is how it would go local SecondFrame = player.PlayerGui:WaitForChild("ScreenGui"):WaitForChild("SecondFrame") -- Im assuming this is how it would go local bool = true if FirstFrame.Visible == true then bool = true end script.Parent.MouseButton1Click:Connect(function() if bool then wait(5) script.Parent.Parent.FirstFrame.Visible = false if not bool then script.Parent.Parent.SecondFrame.Visible = true wait(5) script.Parent.Parent.SecondFrame.Visible = false

 end

end end)

4 comments

0

its so broken

0

yup lemme fix my code block for ya real quick

0

what does an error say in the output

0

"FirstFrame is not a valid member of Frame"

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