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

Detecting who clicks?

Asked by
RoyMer 301 Moderation Voter
9 years ago

How can I detect the person that clicks the ClickDetector brick?

This is what I thought but I was wrong...

1local owner = script.Parent.Parent.Parent.Parent.OwnerName.Value
2function onClicked(owner)

1 answer

Log in to vote
1
Answered by 9 years ago

The MouseClick event in a ClickDetector yields an argument for the player who clicked the brick. Example-

1detect = script.Parent.ClickDetector
2 
3detect.MouseClick:connect(function(player)
4    player.TeamColor = BrickColor.new("Bright blue")
5end)
Ad

Answer this question