Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

3 comments

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.

0

I actually just got it working. I could not have done it without a part from your code. Thank you!

0

oh cool :) no problem

This discussion is preserved as it was. New answers, comments, and votes are closed.