I know how to find out the name of the player who clicked a brick using a click detector, but what if I want to find out who clicked a gui? Please answer with some help!
✓ ANSWER ACCEPTED
How do you find out who clicked an Image button?
1 answer
✓ Accepted answer
You can't find out who pressed a gui since that gui is only in the players gui. This code basically shows how to use this.
local target = game.Players.LocalPlayer
local owner = "Spooksletsky"
script.Parent.MouseButton1Down:connect(function()
if target and target.leaderstats.Money.Value >= 100 and target.Name == owner then
target.leaderstats.Money.Value = target.leaderstats.Money.Value-100
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
A GUI by default is in the Player's PlayerGui unless it is a SurfaceGUI or Billboard GUI. If it is a ScreenGui, just use a localscript to get the LocalPlayer.
So I just do- if script.Parent.Value==LocalPlayer then -then it will go on?
Ohhh I get it now thanks