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
8 years ago

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

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

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

1 answer

Log in to vote
1
Answered by 8 years ago

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

detect = script.Parent.ClickDetector

detect.MouseClick:connect(function(player)
    player.TeamColor = BrickColor.new("Bright blue")
end)
Ad

Answer this question