A functional (shop ui button) that brings up a shop ui

  1. **What do you want to achieve?

a functional button that makes a shop ui visible

  1. **What is the issue? keep in mind im fairly new to coding.
    i have been working at this for a while now, and i cant seem to find a fix
    when i press the ui button the shop ui is not visible, heres an example of the code below

    Screenshot (24)

You aren’t using local function right. Try replacing local function(Appear) with
local function Appear()

1 Like

Hey hey, there are a couple issues with this!

  1. MouseButton1Click has to be connected to something! What I mean by that is instead of just saying MouseButton1Click:Connect(Appear), you’d have to do WhateverTheButtonNameIs.MouseButton1Click:Connect(Appear)

  2. This isn’t so much of an issue but it might be helpful knowledge to you and save some headaches in the future! If you’re looking for shorter variables, you should reference the previous variable. For example in your code I see

local localPlayer = game.Players.LocalPlayer
local ExitButton = game.Players.LocalPlayer.PlayerGui.ScreenGui.TextButton

-- Could be:
local localPlayer = game.Players.LocalPlayer
local ExitButton = localPlayer.PlayerGui.ScreenGui.TextButton
  1. It looks like your appear function won’t actually do anything until the ExitButton is clicked looking at your script!

If you’re looking for just a simple visible / not-visible whenever a button is clicked, try this!

local Player = game.Players.LocalPlayer
local OpenButton = script.Parent
local CloseButton = script.Parent.Parent.ShopFrame.Exit
local ShopFrame = script.Parent.Parent.ShopFrame

	ShopFrame.Visible = true

	ShopFrame.Visible = false

1 Like