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

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

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.

1 comment

0

By the way the reason why there is two "ScreenGui"s is because I named the frame "ScreenGui".

5 answers

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

2 comments

0

1st of all, this script would not work because you are not defining that the GUI has to be visible for the localplayer.

0

I don't know where you got that data from, but that's a solid no.

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.

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

Try this

8 comments

0

Thats just adding a end to the script.

0

No when you press the the button it makes the top frame not visible and makes the second frame visible

0

It DID NOT WORK AND ALSO THAT IS BASICLY THE SCRIPT I AM ASKING HELP FOR.

0

YOUR SCRIPT DOES NOT WORK.

0

calm down, nobody wants to help you if you have a temper, geesh.

0

Make sure the paths to to the frame are correct

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.

0

@Osamiku ~ Agreed.

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)
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)

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