Help with open ui code

i have been working on a game and want to make a shop ui that will open when you press a button i have done this before but for some reason its not working

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

i couldnt get a screenshot of the explorer so ill just explain it

i have a screen gui in starter gui
inside of that ui is a ui named shopframe
also inside of screen gui is a text button that has the script above

btw the script was working yesterday

1 Like
local frame = script.Parent.Parent.shopframe
local button = script.Parent

button.MouseButton1Click:Connect(function()
	frame.Visible = not frame.Visible
end)

image

it didnt seem to work. maybe its becouse i have multiple frames inside of the shopframe?

Could you send me a screen shot?

Is it a regular script? It should be a local script.
Also:

1: Add ScreenUI to StarterUI - 2: Add frame, 3: add text button, add localscript and write the following

local frame = script.Parent.Parent.FrameNameHere 
local buttonui = script.Parent

buttonui.MouseButton1Click:Connect(function()   print("button clicked.")

script.Parent.Parent.Frame.Visible = true print("Frame is now visible.")


Unless your typing in the name of the frame inside of shopframe, then it should work.

i put it in a local script and it is named shopframe

im takng the screenshot
aaaaaaa

set it up like this (note: local script is in textbutton) :
oik ok k ok

then enter this code in the local script:

works

thats the code i was using and i didnt work

Is the textbutton in a frame? if it is put it in starterGUI and test?

the text button is in starter gui not a frame

Click on that arrow to close that long chain gui,

so, you could put inside a local script inside of that button :

script.Parent.MouseButton1Click:connect(function()
   script.Parent.Parent["shop frame"].Visible = not   script.Parent.Parent["shop frame"].Visible
end)

local player = game.players.localplayer
local frame = game.ShopGui.Frame
script.parent.mousebutton1click:Connect(function()
player.playergui.frame.Visible = true

Bro why are there so many Ui’s?

its a complicated shop ui you can see it if you want

it didnt seem to work i can put a picture of the stuff inside the button

The script i gave works perfectly for me. Ill keep trying to see what the issue is for you.

Oh So you are trying to make a shop system? I guess theres also a in game
currency?