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