generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: How do I access the player that used a ClickDetector?

Previous Thread :: Next Thread 
iKyler is not online. iKyler
Joined: 09 Nov 2008
Total Posts: 2712
28 Jun 2012 09:10 PM
Title.
I've seen in scripts that people use "playerWhoClicked".
Report Abuse
dddylan98 is not online. dddylan98
Joined: 16 Jul 2008
Total Posts: 1497
28 Jun 2012 09:11 PM
I might be wrong but I don't think you can that easily...
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
28 Jun 2012 09:14 PM
script.Parent.ClickDetector.MouseClick:connect(function(player)
--Stuff
end)
Report Abuse
TwoBoo is not online. TwoBoo
Joined: 08 Feb 2011
Total Posts: 10790
28 Jun 2012 09:15 PM
Workspace.Part.ClickDetector.MouseClick:connect(function(playerWhoClicked)
print("Part was clicked by: " .. playerWhoClicked.Name)
end)

http://wiki.roblox.com/index.php/MouseClick
Report Abuse
iKyler is not online. iKyler
Joined: 09 Nov 2008
Total Posts: 2712
28 Jun 2012 09:23 PM
So I have to use an anonymous function to do it?
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
28 Jun 2012 09:25 PM
where Usually You see

function onClick()

end



do

function onClick(player)

end


Where "player" is game.Players.PlayerThatClickedTheButton
Report Abuse
TwoBoo is not online. TwoBoo
Joined: 08 Feb 2011
Total Posts: 10790
28 Jun 2012 09:28 PM
It can be either;

function yo(playerWhoClicked)
print("Part was clicked by: " .. playerWhoClicked.Name)
end
game.Workspace.Part.ClickDetector.MouseClick:connect(yo)

or

Workspace.Part.ClickDetector.MouseClick:connect(function(playerWhoClicked)
print("Part was clicked by: " .. playerWhoClicked.Name)
end)
Report Abuse
iKyler is not online. iKyler
Joined: 09 Nov 2008
Total Posts: 2712
28 Jun 2012 09:30 PM
Thanks for the explaination.
Report Abuse
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
28 Jun 2012 09:54 PM
Hurray for concatenation!




~"If I win the lottery, the first thing I'm buying is an optical mouse"~
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
28 Jun 2012 09:56 PM
I might need this later on :O
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image