01 | script [ "Menu" ] .Parent = game.Players.LocalPlayer.PlayerGui |
02 |
03 | --Locals |
04 | local Players = game:GetService( "Players" ) |
05 | local StarterGui = game:GetService( "StarterGui" ) |
06 |
07 | --GUI Reference |
08 | Gui = game.StarterPlayer.StarterPlayerScripts.EnterGame.Menu |
09 |
10 | --Makes sure that the player doesn't spawn at the start. |
11 | game.Players.CharacterAutoLoads = false |
12 |
13 | --When the player loads into the game, it shows the GUI |
14 | game.Players.PlayerAdded:Connect( function (player) |
15 | for _, gui in pairs (StarterGui:GetChildren()) do |
Hello! I have been trying to add a menu to my game. The problem I originally had was that the main menu wouldn't show due to Character auto loads being off. I solved this by searching it up on the all mighty dev forums. But the next problem was the error in the title: Menu is not a valid member of LocalScript "Players.MyUserName.PlayerScripts.EnterGame" Anyone know where I made my mistake?
(Keep in mind I'm new)
Thanks.
Due to lack of context, I can't understand exactly what you are trying to achieve with this script, but normally, you would'nt parent a GUI under a script. If you did, then please provide some more context, if you did not, then there's your problem. Simply parenting a GUI under StarterGui
will automatically replicate to a player's PlayerGui.