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

My GUI script does not work even though there are no errors?

Asked by
pevdn 32
4 years ago

Can I please have some help with this script?

script.Parent.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.PlayerGui.ScreenGui.ScreenGui.Visible = false
end)

wait(0)

game.StarterGui.ScreenGui.Frame.Visible = true

It is meant to say that if I click a TextButton another GUI will appear.

0
By the way the reason why there is two "ScreenGui"s is because I named the frame "ScreenGui". pevdn 32 — 4y

5 answers

Log in to vote
0
Answered by 4 years ago

First of all your code is repetitive and is a bad practice.

Add the local script in the frame. Make sure the frame is not visible in the first place.

Then write this

script.Parent.MouseButton1Click:Connect(function()
     script.Parent.Visible = true
wait(3)
script.Parent.Visible = false
0
1st of all, this script would not work because you are not defining that the GUI has to be visible for the localplayer. pevdn 32 — 4y
0
I don't know where you got that data from, but that's a solid no. maxpax2009 340 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

This should do it:

script.Parent.MouseButton1Click:Connect(function()
    game.Players.LocalPlayer.PlayerGui.ScreenGui.ScreenGui.Visible = false
    game.StarterGui.ScreenGui.Frame.Visible = true
end)

But if that does not work, try adding wait:

script.Parent.MouseButton1Click:Connect(function()
    game.Players.LocalPlayer.PlayerGui.ScreenGui.ScreenGui.Visible = false
    wait(0)
    game.StarterGui.ScreenGui.Frame.Visible = true
end)

If none of these above work, try using the other answers or contact Roblox.

Log in to vote
-1
Answered by 4 years ago
script.Parent.MouseButton1Click:Connect(function()
    game.Players.LocalPlayer.PlayerGui.ScreenGui.ScreenGui.Visible = false
    game.StarterGui.ScreenGui.Frame.Visible = true
end)

Try this

0
Thats just adding a end to the script. pevdn 32 — 4y
0
No when you press the the button it makes the top frame not visible and makes the second frame visible Barty200 85 — 4y
0
It DID NOT WORK AND ALSO THAT IS BASICLY THE SCRIPT I AM ASKING HELP FOR. pevdn 32 — 4y
0
YOUR SCRIPT DOES NOT WORK. pevdn 32 — 4y
View all comments (4 more)
0
calm down, nobody wants to help you if you have a temper, geesh. maxpax2009 340 — 4y
0
Make sure the paths to to the frame are correct Barty200 85 — 4y
0
Hey, @SmileMonkeyBoi? This website is full of humble scriptures willing to try and help other people with their errors, they are not obligated to help you but they do it anyways out of kindness. Just because it doesn't work doesn't mean you can lash out on them, maybe they don't know either. Osamiku 12 — 4y
0
@Osamiku ~ Agreed. maxpax2009 340 — 4y
Log in to vote
-1
Answered by
SnowieDev 171
4 years ago

Here, check if it works now.

script.Parent.MouseButton1Click:Connect(function()
    game.Players.LocalPlayer.PlayerGui.ScreenGui.ScreenGui.Visible = false
    game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = true
end)
Log in to vote
-1
Answered by 4 years ago
Edited 4 years ago
script.Parent.MouseButton1Click:Connect(function()
    game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("ScreenGui").ScreenGui.Visible = false
    game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("ScreenGui").Frame.Visible = true
end)

Answer this question