This is my current code:
local gui = Workspace.ShopGui local shopgui = Workspace.ShopGui function onClick() Instance.new(shopgui) Players.Children.PlayerGui end script.Parent.MouseButton1Click:connect(onClick)
Instance.new creates a brand new instance from the Roblox objects. If you clone the GUI and set it's parent to the local players GUI, then your shop GUI will appear on the players screen:
local shopgui = Workspace.ShopGui local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() shopgui:Clone().Parent = player.PlayerGui end)
This must be in a localscript to work! LocalPlayer only works when run in a local script.
Do you want this in a StarterGui or Workspace?
Workspace I don't know. Just curious though.
local gui = Workspace.ShopGui local shopgui = Workspace.ShopGui function onClick() shopgui:Clone().Parent = script.Parent.Parent.Parent.Parent -- Minus a parent if the textbutton is not in a frame end script.Parent.MouseButton1Click:connect(onClick)
What you did
local gui = Workspace.ShopGui local shopgui = Workspace.ShopGui function onClick() Instance.new(shopgui) -- There is not basic object named shopgui either way if it was a part this the it would be like "Part" end script.Parent.MouseButton1Click:connect(onClick)
Notice that idk if you have it inside a frame btw.
local GUI = Game.StarterGUI.GUI -- change the name of GUI if you want but it wont work unless its in StarterGUI. local Frame = Instance.new("Frame") local shopGUI = Game.StarterGUI.GUI.Frame -- Add a TextButton too. Textbutton.Text = "" -- put the text you want between the "" -- You cant make Instance.new(shopgui) beacuse theres nothing Like it in Advanced Objects. script.Parent.MouseButton1Click:connect(onClicked)