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: Getting player from MouseButton1Down

Previous Thread :: Next Thread 
Xephyric is not online. Xephyric
Joined: 26 Mar 2009
Total Posts: 2270
15 Dec 2013 02:30 PM
script.Parent.Claim.MouseButton1Down:connect(function(p)
end

How can I get the player from p?
(Making a variable to define the name or object of the player)

The reason I need this is because this is in a SurfaceGui that everyone can see, so it is not a localscript, hence, "game.Players.LocalPlayer" does not work
Report Abuse
Lepado12 is not online. Lepado12
Joined: 19 Sep 2009
Total Posts: 3931
15 Dec 2013 02:31 PM
local p = Workspace.Player

Tried that?
Report Abuse
getkoed is not online. getkoed
Joined: 18 Feb 2010
Total Posts: 2298
15 Dec 2013 02:32 PM
nonono

.MouseButton1Down:connect(function(x, y)

-- x and y would be the mouse coordinates

You'd have to get to the player with script.Parent.Parent.Parent etc etc
Report Abuse
dogwarrior24 is not online. dogwarrior24
Joined: 10 Nov 2010
Total Posts: 1401
15 Dec 2013 02:32 PM
That sets a very bad problem. Because you need a local script ran on the player to make the buttons not be clickable by other people.
Another alternative is to make it not seeable and instead put it in their playergui, but there isnt really a way to get the player from MouseButton1Down.
Report Abuse
Xephyric is not online. Xephyric
Joined: 26 Mar 2009
Total Posts: 2270
15 Dec 2013 02:34 PM
I want this gui to be able to be seen by all players, not locally.
It is under workspace
Report Abuse
dogwarrior24 is not online. dogwarrior24
Joined: 10 Nov 2010
Total Posts: 1401
15 Dec 2013 02:34 PM
Pretty much impossible.
Report Abuse
Xephyric is not online. Xephyric
Joined: 26 Mar 2009
Total Posts: 2270
15 Dec 2013 02:35 PM
@Lepado
What would that do?
Report Abuse
getkoed is not online. getkoed
Joined: 18 Feb 2010
Total Posts: 2298
15 Dec 2013 02:35 PM
Impossible? wat

if you put the gui in StarterGui, everyone'd get it
what's the problem here really
Report Abuse
Xephyric is not online. Xephyric
Joined: 26 Mar 2009
Total Posts: 2270
15 Dec 2013 02:36 PM
@getkoed

Everyone would see different instances of it, and would not be showing the same things to all the players
Report Abuse
getkoed is not online. getkoed
Joined: 18 Feb 2010
Total Posts: 2298
15 Dec 2013 02:36 PM
Well then get a script that updates it so everyone gets to see the same stuff :c
Report Abuse
getkoed is not online. getkoed
Joined: 18 Feb 2010
Total Posts: 2298
15 Dec 2013 02:37 PM
Oh wait, surfacegui :U
lemme think now
Report Abuse
Xephyric is not online. Xephyric
Joined: 26 Mar 2009
Total Posts: 2270
15 Dec 2013 02:38 PM
Also, take this into consideration.
This gui needs to be able to interact with workspace, changing things that are not local.
So it can't be a localscript
Report Abuse
Quorum is not online. Quorum
Joined: 25 Oct 2013
Total Posts: 4680
15 Dec 2013 02:39 PM
Still not an excuse to shoot down a script which replicates all of the changes to all players, considering you can use RemoteFunctions if you really need to communicate between server side and client side scripts.
Report Abuse
Xephyric is not online. Xephyric
Joined: 26 Mar 2009
Total Posts: 2270
15 Dec 2013 02:41 PM
@Quorum
I don't understand what you're saying e.e
Report Abuse
holden169 is not online. holden169
Joined: 11 Jul 2012
Total Posts: 185
01 Apr 2014 05:47 AM
Well....
game.Workspace:FindFirstChild(p.Name)
Or
game.Players:FindFirstChild(p.Name)
Report Abuse
Geodesic is not online. Geodesic
Joined: 02 Jun 2013
Total Posts: 998
01 Apr 2014 05:52 AM
....seriously guys
localscript in startergui will work

local player = game.Players.LocalPlayer
local surfacegui = Workspace.Part.SurfaceGui

surfacegui.TextButton.MouseButton1Click:connect(function()
print(player.Name..' clicked the button')
end)
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