Still have questions? Join our Discord server and get real time help.
0

# How do I find the player who clicked on a TextButton on a surfacegui? [closed]

Asked by 5 years ago

I need to find the player after a textbutton in a surfacegui is clicked on, but I don't know how to retrieve the player, unlike a textbutton in a screengui. How can I do this?

### Locked by NinjoOnline, LordDragonZord, Redbullusa, and BlueTaslem

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

2
Answered by 5 years ago

This is actually pretty simple. All you have to do is put the SurfaceGui inside StarterGui then use a LocalScript to get game.Players.LocalPlayer then Adornee it to the part with this: script.Parent.Parent.Adornee = game.Workspace.Part (Hopefully you should know how to edit it. Change Part to wherever the Part is located in Workspace, and change script.Parent.Parent to wherver the SurfaceGui is, NOT the button.)

Hope this helped and make sure +1 and accept if this worked. If it didnt then please reply and I will answer any questions you need answered.

• NinjoOnline

EXAMPLE I USED:

local player = game.Players.LocalPlayer
script.Parent.MouseButton1Down:connect(function(skip)
player.Character.Humanoid.Health = 0
end)


EDIT

Family Tree:

game
Workspace
VIPRoom
Frame
Picture
StarterGui
SkipGui
Button
LocalScript


The above is just a bit more just incase you get confused.

0
Thank you! whyOmustOitObeOme 2 — 5y
0
np :D Just made a last minute edit just in-case. Thanks for the +1 and accept, hope I helped and explained as much as possible. NinjoOnline 1147 — 5y