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

Updated: How to make a ScreenGui appear onClick of a SurfaceGui?

Asked by 8 years ago

I have a SurfaceGui with a TextButton inside it. I am stuck at a point where the button is clicked and a gui comes up for the player to interact with. I don't really have any supplementary scripts since I am very stuck on this topic. I've looked at the WIKI and the Forums and they say that it is not possible to see who clicked a SurfaceGui button unless it is in the StarterGui. Sorry again for not having much code to put in here. I don't want this to seem like a request, but I have really hit a wall. Here it is:

function onClicked()
-- Need to locate playerGui
-- PlayerGui.Screen.Frame.Visible = true
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

I'm trying to make the ScreenGui visible when a SurfaceGui Button is clicked.

1 answer

Log in to vote
0
Answered by 8 years ago

if it's a local script,

local player = game.Players.LocalPlayer
function onClicked()
player.PlayerGui-- Need to locate playerGui
player.PlayerGui.Screen.Frame.Visible = true
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)


if normal script,

game.Players.PlayerAdded:connect(function(player)
function onClicked()
player.PlayerGui-- Need to locate playerGui
player.PlayerGui.Screen.Frame.Visible = true
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

but if the wiki and forum says it's not possible, then it might not be. but good luck using these.

0
It says that there is an '=' Expected after player on line 4 (For Both Scripts) in the output, but it wouldn't make sense to put one there. TSK_Uncovered 55 — 8y
0
I actually just got it working. I could not have done it without a part from your code. Thank you! TSK_Uncovered 55 — 8y
0
oh cool :) no problem User#12356 0 — 8y
Ad

Answer this question