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

Info is not a valid member of ScreenGui, even though it is?

I made a start menu for my game that works fine in test mode, but when I go to a normal game, it will not work, and the log gives me "Info is not a valid member of screenGUI", but it is. Can anyone help with this? (Info is a textlabel by the way)

local Player = game.Players.LocalPlayer
local Menu = script.Parent
local Play = Menu.Play
local About = Menu.About
local HasPressedPlay = false
local info = Menu.info
local Minimize = info.Minimize
local Back = Menu.Backing

function MouseEnterPlayButton()
	Play.FontSize = "Size60"

end




function MouseLeftPlayButton()
	Play.FontSize = "Size36"
	
	
end





function MouseEnterAboutButton()
	About.FontSize = "Size60"

end




function MouseLeftAboutButton()
	About.FontSize = "Size36"
	
	
end




function PlayGame()
	if HasPressedPlay == false then
		for i = 1, 40 do
			if i <= 20 then
			Play.Position = Play.Position + UDim2.new(0.05, 0, 0, 0)
			end
			if i >= 10 then
				About.Position = About.Position + UDim2.new(0.05, 0, 0, 0)
				Menu.Title.Position = Menu.Title.Position + UDim2.new(0.05, 0, 0, 0)
				Menu.Version.Position = Menu.Version.Position + UDim2.new(0.05, 0, 0, 0)
			end
			if i == 40 then
				Back.Visible = false
			end
			wait()
		end
	end
	
end


function Minimizeinfo()
	info.Visible = false
end

function ShowAbout()
	info.Visible = true
end



About.MouseButton1Down:connect(ShowAbout)
Minimize.MouseButton1Down:connect(Minimizeinfo)
Play.MouseButton1Down:connect(PlayGame)
Play.MouseLeave:connect(MouseLeftPlayButton)
Play.MouseEnter:connect(MouseEnterPlayButton)
About.MouseLeave:connect(MouseLeftAboutButton)
About.MouseEnter:connect(MouseEnterAboutButton)


-- 27, 42, 53

1 comment

0

You're looking for it before it's loaded, just add a :WaitForChild()

1 answer

✓ Accepted answer

The problem is that it is looking for this info before it is even loaded yet, to solve this you need to use :WaitForChild()

local Player = game.Players.LocalPlayer
local Menu = script.Parent
local Play = Menu:WaitForChild("Play")
local About = MenuWaitForChild("About")
local HasPressedPlay = false
local info = Menu:WaitForChild("info")
local Minimize = info:WaitForChild("Minimize")
local Back = Menu:WaitForChild("Backing")

function MouseEnterPlayButton()
    Play.FontSize = "Size60"

end




function MouseLeftPlayButton()
    Play.FontSize = "Size36"


end





function MouseEnterAboutButton()
    About.FontSize = "Size60"

end




function MouseLeftAboutButton()
    About.FontSize = "Size36"


end




function PlayGame()
    if HasPressedPlay == false then
        for i = 1, 40 do
            if i <= 20 then
            Play.Position = Play.Position + UDim2.new(0.05, 0, 0, 0)
            end
            if i >= 10 then
                About.Position = About.Position + UDim2.new(0.05, 0, 0, 0)
                Menu.Title.Position = Menu.Title.Position + UDim2.new(0.05, 0, 0, 0)
                Menu.Version.Position = Menu.Version.Position + UDim2.new(0.05, 0, 0, 0)
            end
            if i == 40 then
                Back.Visible = false
            end
            wait()
        end
    end

end


function Minimizeinfo()
    info.Visible = false
end

function ShowAbout()
    info.Visible = true
end



About.MouseButton1Down:connect(ShowAbout)
Minimize.MouseButton1Down:connect(Minimizeinfo)
Play.MouseButton1Down:connect(PlayGame)
Play.MouseLeave:connect(MouseLeftPlayButton)
Play.MouseEnter:connect(MouseEnterPlayButton)
About.MouseLeave:connect(MouseLeftAboutButton)
About.MouseEnter:connect(MouseEnterAboutButton)


-- 27, 42, 53


Hope this helps

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