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

Can you script an Opening a GUI from a StarterGui?

Asked by 9 years ago

Hi, I am not quite sure about this script. But it just not working, I tried testing this as a local script and tested in-game and in test server. Still couldn't work!

Can you figure this script out?

function lighting()
local Control = game:GetService("StarterGui").WorkingOnGui.CeilingLightControl.Visible = true
end

script.Parent.MouseButton1Down:connect(lighting)

I know that I have tried tweaking the script by myself, but what I have tweaked is below.

function lighting()
game:GetService("StarterGui").WorkingOnGui.CeilingLightControl.Visible = true -- The difference between the old and the new script is that I have taken out "local Control = ".
end

script.Parent.MouseButton1Down:connect(lighting)

But the script didn't work, so what I did is that I tried it as an Local Script - but that didn't work either!

Is there any other solutions?

Thanks!

1 answer

Log in to vote
0
Answered by 9 years ago

You need to access the player gui by going through:-

game.Players.[player name].PlayerGui.WorkingOnGui.CeilingLightControl.Visible = true

Hope this helps

0
This is not what I am talking about. This is just opening a GUI when you put in a player username into the script. BenHall4433 0 — 9y
0
Im a bit confused, do you mean opening a gui from another? User#5423 17 — 9y
0
Opening a GUI from a SurfaceGui. BenHall4433 0 — 9y
0
You cannot get the playe through a SurfaceGui unless it is the parent of the player. http://wiki.roblox.com/index.php?title=API:Class/SurfaceGui. It is one of the limitations of a SurfaceGui User#5423 17 — 9y
View all comments (5 more)
0
I don't understand with that Wiki. Can you just make a code? BenHall4433 0 — 9y
0
In short a SurfaceGui has no way of getting the player so you are un able to show them the gui unless the parent of the SurfaceGui is the player. User#5423 17 — 9y
0
You mean having a SurfaceGui > Frame > Local Script? BenHall4433 0 — 9y
0
I mean "game.Players.[player name].PlayeGui.SurfaceGui" this has a refference to the player where as "game.Workspace.Part.SurfaceGui" does not so you cannot find the player User#5423 17 — 9y
0
Can you put in the script, so that it automaticaly find the player rather having me to type it in. BenHall4433 0 — 9y
Ad

Answer this question