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

Ife not working. Frame is not a valid member of screengui Help?

I'm making a gui and I'm testing it and it doesn't work and says games is not a valid source of screenGui. Please help me.

local main = script.Parent.Parent.Parent.home local music = script.Parent.Parent.Parent.Games local shop = script.Parent.Parent.Parent.Music local info = script.Parent.Parent.Parent.flightinfo local camera = script.Parent.Parent.Parent.Cameras local gui = script.Parent.Parent.Parent.Parent.ScreenGui

function onClicked() music.Visible = false shop.Visible = false info.Visible = false main.Visible = true camera.Visible = false end

script.Parent.MouseButton1Click:connect(onClicked)

2 comments

0

Script pls

0

Ill help, let me just set up my telepathy equipment real quick

1 answer

first of all, I cannot stress this enough :

PLEASE USE CODE BLOCKS

but it seems likely to be 1 of 3 scenarios,

  1. you had a spelling error on that line,

correct the spelling error

  1. the thing doesn't exist,

redefine the variable to something that exists

  1. or you didn't use WaitForChild()

change your local script to use WaitForChild

if you think it is the third scenario, try altering your script so it looks something like this

local thing = script.Parent.Parent.Parent
local main = thing:WaitForChild("home") 
local music = thing:WaitForChild("Games") 
local shop = thing:WaitForChild("Music")
local info = thing:WaitForChild("flightinfo")
local camera = thing:WaitForChild("Cameras") 
local gui = thing.Parent:WaitForChild("ScreenGui")

function onClicked() 
	music.Visible = false 
	shop.Visible = false 
	info.Visible = false 
	main.Visible = true 
	camera.Visible = false 
end

script.Parent.MouseButton1Click:connect(onClicked)

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