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

Is it possible to get the player through a MouseClick event?

Asked by 10 years ago

I want to get the Player from when they click the Merchant's Torso. If I am able to get the Player then I can manipulate stuff in the player such as adding GUIs, Tools etc.

ClickDetector = script.Parent
Torso = script.Parent.Parent
MerchantName = Torso.Parent.Name

ClickDetector.MouseClick:connect(function()
print(MerchantName.." 's chat AI has started.")
end)

Thank you for the help!

1 answer

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

Yes.

MouseClick events have a built in parameter equal to the Player who clicked it.

clickDetector.MouseClick:connect(function(plr)
    print(plr.Name.." clicked the button!")
end)
Ad

Answer this question