Cant Make It Where When A Player Clicks Shop Inside A Gui And Another Shop Opens

On My UI I Want It Where You can click on this button and open another ui and close the other one

the first one is Gui2 And i want it to open a frame called UI
tEST991

1 Like
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Visible = false
(your shop).Visible = true 
end)
2 Likes

This in a local script inside gui or ?

is it a server side or a client side you are doing it for?

Yes. It’s a local script inside the button that you want to click.

It made the button disapear and the ui stayed. :confused:

Nvm my bad. script.Parent.Parent.MouseButton1Click*
If that doesnt work, try script.Parent.Parent.Parent

script.Parent.Parent.MouseButton1Click:Connect(function()
script.Parent.Visible = false
(your shop).Visible = true -- !Change this to your shop gui!
end)

Hi, an easier way to call a function is using the β€œRemoteEvents” I leave you the link for more information, for example if you want the user to get another GUI screen you must call it through clients in RemoteEvents, if you do it by server, the whole server will look at the gui.

Example:

  1. Create a remote event in ReplicatedStorage
  2. Inside the button script you will create a Script and call the fireclient function
local rs = game:GetService("ReplicatedStorage")
local RemoteEvent = rs:FindFirstChild("RemoteEvent")

script.Parent.MouseButton1Click:Connect(function()
      RemoteEvent:FireClient()
end)

3.You will go to the other GUI you want to display and also call the remote event option.
4. You create a LocalScript and enter the following

local rs = game:GetService("ReplicatedStorage")
local RemoteEvent = rs:FindFirstChild("RemoteEvent")

RemoteEvent.OnClientEvent:Connect(function()
       script.parent.visible = true
      --Here you can create an open and close system, but that is up to you.*
end)

It is the most convenient way to avoid future bugs or corruptions in the server that can slow it down.

You should leave Gui handling to the client only (through the use of local scripts).

1 Like