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

How do I get the name of the player who clicked a ClickDetector?

Asked by
Axenori 124
4 years ago

How do I get the name of a player who activated a ClickDetector? (in this context by player I mean the name of their character model in Workspace)

1 answer

Log in to vote
0
Answered by 4 years ago

whenever the ClickDetector.MouseClick() event fires, it passes the player object of the player that clicked it..

so all you have to do is:

clickDetector.MouseClick:Connect(function(player)
    print(player.Name, " clicked the button")
end)
0
I agree! Soban06 410 — 4y
Ad

Answer this question