Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

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

Asked by 1 year ago

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)

0
hope it helped AltNature 169 — 1y

3 answers

Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

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()
0
ill test it thank you! vincentthecat1 92 — 1y
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 AltNature 169 — 1y
0
If you need me to explain I will post an explanation in answers AltNature 169 — 1y
Ad
Log in to vote
0
Answered by
AltNature 169
1 year ago
Edited 1 year ago

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)


0
Is it a local or just normal script? vincentthecat1 92 — 1y
0
Local Script AltNature 169 — 1y
0
Ill check it okay vincentthecat1 92 — 1y
0
It seems to now have worked Should I show you what I put in vincentthecat1 92 — 1y
View all comments (4 more)
0
Absolutley fine AltNature 169 — 1y
0
Not have wroked * I meant vincentthecat1 92 — 1y
0
Vincent that should work now AltNature 169 — 1y
0
It seems to not work still vincentthecat1 92 — 1y
Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

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)

0
its so broken vincentthecat1 92 — 1y
0
yup lemme fix my code block for ya real quick AltNature 169 — 1y
0
what does an error say in the output AltNature 169 — 1y
0
"FirstFrame is not a valid member of Frame" vincentthecat1 92 — 1y

Answer this question