I have a important Gui in Lighting I need to get in the startergui... I have it so when you click on the surfacegui, then I want it to bring the gui from Lighting into the startergui so you can choose your car... The surface gui says click me to spawn car. Any help?
script.Parent.MouseButton1Click:connect(function() wait (1) script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Lighting.Carselect:Clone() end)
First of all, the parent cannot be StarterGui as it is cloned into the player. You have to put it in the PlayerGui inside the player. Here's the example script (Also, do not use lighting. It is literally the most annoying storage device to possibly use. Put it in ReplicatedStorage):
script.Parent.MouseButton1Click:connect(function(clicker) local clone = game.Lighting.Carselect:Clone() clone.Parent = clicker.PlayerGui --The clicker variable introduced in the first line shows the player that clicked, so we'd take the player and put it in his/her PlayerGui end)
Why can't it be something easy like this?
function onClicked() while true do game.StarterGui.Carselect.Frame.Visible = true wait(1) end end script.Parent.MouseButton1Click:connect(onClicked)
Simple error, you are not setting the parent, but instead of all those parents, try this. Since you said it is a surface gui, we also need to set the adornee. Use a local script.
function buttonclicked() local gui = game.Lighting.Carselect:Clone() gui.Adornee = game.Workspace.Part-- Set this to whatever you want the gui to show up on gui.Parent = game.Players.LocalPlayer.PlayerGui -- Set this to where you want the gui to be cloned to end script.Parent.MouseButton1Click:connect(buttonclicked)
Hoped this helped.