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?
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.
EXAMPLE I USED:
local player = game.Players.LocalPlayer script.Parent.Parent.Adornee = game.Workspace.VIPRoom.Frame.Picture script.Parent.MouseButton1Down:connect(function(skip) player.leaderstats.Level.Value = 10 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.
Locked by NinjoOnline, EzraNehemiah_TF2, Redbullusa, and BlueTaslem
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?