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
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.
1 | local Frame = script.Parent.Parent:WaitForChild( "Frame" , 1 ) -- 1 is called the timeOut parameter. |
2 |
3 | script.Parent.MouseButton 1 Click:Connect( function () |
4 | Frame.Visible = true |
5 | end ) |
Try typing that instead:
1 | local Frame = script.Parent.Parent.Frame |
2 | function frameVisible() --you can change the "frameVisible" to whatever you want! |
3 | Frame.Visible = true |
4 | end |
5 | script.Parent.MouseButton 1 Click: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!