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

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

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

✓ Accepted answer

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

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!

2 comments

0

I'm getting the same error.

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

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