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

How may I identify the character that press a Button under SurfaceGui?

Asked by 8 years ago

So I know in a ScreenGui it's easy to identify the Player especially using the LocalPlayer from the a LocalScript inside of StarterGui but, I was wondering how you would identify a Player under a SurfaceGui and the SurfaceGui is obviously under a Part in the Workspace.... I have tried to use player as an argument however it didn't work out... This is my failed attempt -_- I put this script inside of the TextButton under a Frame inside of a SurfaceGui which is inside of the Part.... If you help me with this I would be very greatful! Thank you :D

script.Parent.MouseButton1Down:connect(function(player)
    print("Hello".. player.Name "in the Club")
end)

Once again thank you for reading my question and I hope you have a solution for my problem!

1 answer

Log in to vote
1
Answered by 8 years ago

It's simply not feasible when the SurfaceGui is in Workspace

In order to determine the player that used a SurfaceGui, you have to put the SurfaceGui inside of the PlayerGui and set the Adornee property. There is no practical way to get who did it if the SurfaceGui is in Workspace, and no way to do it if you're attempting to get interaction through a Script (Which is bad practice)

0
Well if I put it inside of the PlayerGui the player won't be able to see the SurfaceGui -_- KingLoneCat 2642 — 8y
0
Wrong, dippy. That's why you set the Adornee property. User#6546 35 — 8y
Ad

Answer this question