Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I get a Gui from Lighting To StarterGui?

Asked by 8 years ago
Edited 8 years ago

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)

3 answers

Log in to vote
0
Answered by
itsJooJoo 195
8 years ago
Edited 8 years ago

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)
0
Doesn't work ._. NateDawgGamingRoHD 5 — 8y
0
Do you have FE (FilteringEnabled) on? itsJooJoo 195 — 8y
0
How do i turn that on? NateDawgGamingRoHD 5 — 8y
0
I have it on now what does that change? NateDawgGamingRoHD 5 — 8y
View all comments (6 more)
0
I'm saying this script is better without FE not with it. Ok my other question is, is it in a LocalScript or a ServerScript? itsJooJoo 195 — 8y
0
normal script XD NateDawgGamingRoHD 5 — 8y
0
Ok change it into a LocalScript. And is it in a SurfaceGui or a TextButton inside the SurfaceGui? Omg so many questions XP itsJooJoo 195 — 8y
0
Text button NateDawgGamingRoHD 5 — 8y
0
And i have the local script inside the text button (inside the surface gui) NateDawgGamingRoHD 5 — 8y
0
It should be working... itsJooJoo 195 — 8y
Ad
Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

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)
Log in to vote
-1
Answered by 8 years ago
Edited 8 years ago

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.

0
Doesn't the parent have to be game.StarterGui? NateDawgGamingRoHD 5 — 8y
0
No UltChowsk 85 — 8y
0
What was wrong with this one? ^ UltChowsk 85 — 8y
0
It still doesn't work ._. NateDawgGamingRoHD 5 — 8y
View all comments (2 more)
0
This should work now. UltChowsk 85 — 8y
0
What does it mean "put this where you want the gui to show up on"? NateDawgGamingRoHD 5 — 8y

Answer this question