Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.