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 » Scripters
Home Search
 

Re: how to get player from MouseButton1Click

Previous Thread :: Next Thread 
Qorm is not online. Qorm
Joined: 25 Jul 2010
Total Posts: 1650
02 Jun 2015 05:47 PM
is it possible else how?
Report Abuse
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
02 Jun 2015 05:47 PM
Get it from the gui by using parents or localplayer
Report Abuse
earthyreuben is not online. earthyreuben
Joined: 17 Jan 2010
Total Posts: 669
02 Jun 2015 05:51 PM
Using it in a local script, it is as easy as sending game.Player.LocalPlayer in a MouseButton1Click event
Report Abuse
earthyreuben is not online. earthyreuben
Joined: 17 Jan 2010
Total Posts: 669
02 Jun 2015 05:52 PM
I mistyped, its:

game.Players.LocalPlayer -- Forgot the s on Players
Report Abuse
Qorm is not online. Qorm
Joined: 25 Jul 2010
Total Posts: 1650
02 Jun 2015 06:03 PM
sorry, i wasnt being clear enough. what i meant is:
ex)
button.MouseButton1Click:connect(function(test)
if test.Parent.Name==game.LocalPlayer.Name then
print"this is what i mean!"
end
end)
Report Abuse
earthyreuben is not online. earthyreuben
Joined: 17 Jan 2010
Total Posts: 669
02 Jun 2015 06:15 PM
game.LocalPlayer.Name is invalid. It would be game.Players.LocalPlayer.Name

For you example it would be:

button.MouseButton1Click:connect(function(test)
if test.Parent.Name==game.LocalPlayer.Name then
print"this is what i mean!"
end
end)

However, this still may not be what you want. The MouseButton1Click does not send any arguments. It merely tells when it has been clicked.
Report Abuse
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
02 Jun 2015 06:16 PM
@earthy

FAIL

"game.LocalPlayer.Name"
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
02 Jun 2015 06:17 PM
You don't have to. Your player is already defined by LocalPlayer

local player = game.Players.LocalPlayer

gui.MouseButton1Click:connect(function()
print(player.Name)
end)
Report Abuse
earthyreuben is not online. earthyreuben
Joined: 17 Jan 2010
Total Posts: 669
02 Jun 2015 06:24 PM
@iSpec

lol, didn't notice XD

Copy and pasted his code and forgot to edit it. Got distracted by my chicken I was eating. Sorry about that. :)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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