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

Frame is not a valid member of ScreenGui "Players.LSGar2011.PlayerGui.Shop" ?

Asked by 3 years ago
Edited 3 years ago

Im making a shop, but I can't fix this error. Can someone help me?

Here is the code: ~~~~~~~~~~~~~~~~~local Frame = script.Parent.Parent.Frame

script.Parent.MouseButton1Click:Connect(function() Frame.Visible = true end)

~~~~~~~~~~~~~~~~~

Thank you for taking your time to help me

2 answers

Log in to vote
0
Answered by
NGC4637 602 Moderation Voter
3 years ago

Frame is not a valid member of ScreenGui "Players.LSGar2011.PlayerGui.Shop"

this means that Frame is not a child of the "Shop" Screen gui. meaning the script is saying frame doesn't exist.

if you are 100% sure it is where you specified it is at, try using WaitForChild.

local Frame = script.Parent.Parent:WaitForChild("Frame",1) -- 1 is called the timeOut parameter.

script.Parent.MouseButton1Click:Connect(function()
    Frame.Visible = true
end)

WaitForChild

Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

Try typing that instead:

local Frame = script.Parent.Parent.Frame
function frameVisible() --you can change the "frameVisible" to whatever you want!
Frame.Visible = true
end
script.Parent.MouseButton1Click:Connect(frameVisible) --or you can use MouseClick instead of MouseButton1Click

If your problem still exists, tell me what error you got in the output. I hope I helped!

0
I'm getting the same error. LSGar2011 9 — 3y
0
This is pointless, it does the exact same thing except it's in a useless function. And MouseClick is only for ClickDetectors on 3d Parts wizz_zz 3 — 3y

Answer this question