Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago
Edited 6 years ago

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)

0
Script pls HaveASip 494 — 6y
0
Ill help, let me just set up my telepathy equipment real quick aazkao 787 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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

2) the thing doesn't exist,

redefine the variable to something that exists

3) 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)
Ad

Answer this question