So I made an open and close system and if you click for example "Map 1" button then the map1 brick will be cloned to workspace. The GUIs are in "StarterGui" and the brick that has to be loaded in is in a folder called "Maps" in ReplicatedStorage.
local TPS13B = game.StarterGui["GUi testing"].Frame.TPS13B local ClickDetector = Instance.new("ClickDetector") ClickDetector.Parent = game.StarterGui["GUi testing"].Frame.TPS13B ClickDetector.MouseClick:connect (function(LOAD) local TPS13 = game.ReplicatedStorage.Maps.TPS13:Clone() TPS13.Parent= workspace end)
Please tell me if I missed out on something or if I am wrong,etc..
You have made alot of mistakes.
local player = game.Players.LocalPlayer --define player local gui = player.PlayerGui:WaitForChild("MapGui") --define where the gui is local guibutton = gui.Button -- define gui's button local repStorage = game:GetService("ReplicatedStorage") --get replicated storage guibutton.MouseButton1Down:connect(function() -- now here we use MouseButton1Down for the gui, so when it's clicked we connect the function local map1 = repStorage.Maps.TPS13:Clone() -- let's clone the TPS13 from replicatedStorage's map's folder map1.Parent = game.Workspace -- set it's parent to game.Workspace NOTE that it's game.Workspace not workspace. end)
ClickDetectors are for bricks, not GUIs. StarterGui is where you put all the guis and in online mode you don't need to modify things there, you modify the PlayerGui instead.
This is how your setup should look like: http://prntscr.com/can2ep