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

Menu Is Not A valid Member Of Local script?

script["Menu"].Parent = game.Players.LocalPlayer.PlayerGui

--Locals
local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")

--GUI Reference
Gui = game.StarterPlayer.StarterPlayerScripts.EnterGame.Menu

--Makes sure that the player doesn't spawn at the start.
game.Players.CharacterAutoLoads = false

--When the player loads into the game, it shows the GUI
game.Players.PlayerAdded:Connect(function(player)
	for _, gui in pairs(StarterGui:GetChildren()) do
		gui:Clone().Parent = player:WaitForChild("PlayerGui")
		
end
	
	game.Players.CharacterAutoLoads = false
		Gui.Enabled = true
		
end)

--Disables GUI when we click
	script.Menu.Frame.Enter.MouseButton1Click:Connect(function()
		script.Menu.Frame.Visible = false
	end)

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.

1 answer

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.

2 comments

0

nope I did this on purpose, the post I had read advised that was the way to do it. For clarity, I want to make a menu but not have people killed over and over while they are still in the menu.

0

By "that was the way to do it" I'm assuming you mean that was the way to replicate a GUI to a Player's PlayerGui. While this would technically work, it's of much greater convenience to simply parent the gui under StarterGui.

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