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

Get the name of the player who clicked a SurfaceGui Button?

Asked by
Nidoxs 190
8 years ago

I understand you can do this all well and good with a ClickDetector but I want to do it with a SurfaceGui Button. All it should is print the Clickers name: It's a ServerScript inside of the SurfaceGui.

--doctorbenny2011 09/04/2016 Started 11:00GMT

local a = script.Parent
local Part = a.Parent
local MainFrame = a.MainFrame
local Close = MainFrame.Closed
local Open = MainFrame.Open

--SoundsStart
local UG = Part.UserGranted
local UD = Part.UserDenied
local SU = Part.StartUp
local SD = Part.ShutDown
local DS = Part.DenyS
local AS = Part.AcceptS
local AG = Part.AccessGranted
local AD = Part.AccessGranted
--SoundsEnd

-- THIS BIT        \/\/\/\/\/\/
Close.Button.MouseButton1Down:connect(function(click)
    print(click.Name)
end)
0
What objects are close and button? iUnEarthly 85 — 8y
0
Closed is a Frame, Button is a TextButton inside of Closed. @iUnEarthly Nidoxs 190 — 8y

1 answer

Log in to vote
1
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
8 years ago

Actually Client to SurfaceGui is possible, just not through a ServerScript. What you will need is a LocalScript, the Brick where you want the Gui to appear with a unique name, and the Gui placed in StarterGui.

Within the LocalScript you would have to use the Adornee property of SurfaceGui in order to set the part the Gui should be showing on.

script.Parent.Adornee = game.Workspace.PartWithUniqueName

From there, since it looks like you have the bulk of your script set up, you can use the LocalPlayer value of Players to receive your player value. You can then send a signal to the server via RemoteEvent if you need the server to do something for you.


Hopefully this answered your question. If it did, do not forget to hit the accept answer button. Have any questions, feel free to post them in the comments below.
0
But I'm going to have multiple screens. How would I pinpoint each one? Nidoxs 190 — 8y
Ad

Answer this question