Can I please have some help with this script?
1 | script.Parent.MouseButton 1 Click:Connect( function () |
2 | game.Players.LocalPlayer.PlayerGui.ScreenGui.ScreenGui.Visible = false |
3 | end ) |
4 |
5 | wait( 0 ) |
6 |
7 | game.StarterGui.ScreenGui.Frame.Visible = true |
It is meant to say that if I click a TextButton another GUI will appear.
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
1 | script.Parent.MouseButton 1 Click:Connect( function () |
2 | script.Parent.Visible = true |
3 | wait( 3 ) |
4 | script.Parent.Visible = false |
This should do it:
1 | script.Parent.MouseButton 1 Click:Connect( function () |
2 | game.Players.LocalPlayer.PlayerGui.ScreenGui.ScreenGui.Visible = false |
3 | game.StarterGui.ScreenGui.Frame.Visible = true |
4 | end ) |
But if that does not work, try adding wait
:
1 | script.Parent.MouseButton 1 Click:Connect( function () |
2 | game.Players.LocalPlayer.PlayerGui.ScreenGui.ScreenGui.Visible = false |
3 | wait( 0 ) |
4 | game.StarterGui.ScreenGui.Frame.Visible = true |
5 | end ) |
If none of these above work, try using the other answers or contact Roblox.
1 | script.Parent.MouseButton 1 Click:Connect( function () |
2 | game.Players.LocalPlayer.PlayerGui.ScreenGui.ScreenGui.Visible = false |
3 | game.StarterGui.ScreenGui.Frame.Visible = true |
4 | end ) |
Try this
Here, check if it works now.
1 | script.Parent.MouseButton 1 Click:Connect( function () |
2 | game.Players.LocalPlayer.PlayerGui.ScreenGui.ScreenGui.Visible = false |
3 | game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = true |
4 | end ) |
1 | script.Parent.MouseButton 1 Click:Connect( function () |
2 | game.Players.LocalPlayer:WaitForChild( "PlayerGui" ):WaitForChild( "ScreenGui" ).ScreenGui.Visible = false |
3 | game.Players.LocalPlayer:WaitForChild( "PlayerGui" ):WaitForChild( "ScreenGui" ).Frame.Visible = true |
4 | end ) |