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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

How do you access a players char w/ mouse.Target?

Previous Thread :: Next Thread 
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
02 Jul 2013 08:36 AM
mouse.Target.Character?

God I hate going figuring out these hierarchy
Report Abuse
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
02 Jul 2013 08:45 AM
http://www.youtube.com/watch?v=TgDRMCvdSI0
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
02 Jul 2013 08:53 AM
Not really a big help because the script I needed isn't provided.
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
02 Jul 2013 09:19 AM
I would say mouse.Target.Parent, but I'm not 100% sure.

Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
02 Jul 2013 09:27 AM
Awesomeness is correct, but you still need to check for it.

if mouse and mouse.Target and mouse.Target.Parent:FindFirstChild("Humanoid") then
plr = game.Players:GetPlayerFromCharacter(mouse.Target.Parent)
end
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
02 Jul 2013 09:32 AM
@above

Yep.

I assumed that he would do that himself, but thanks for posting that anyway :)
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
02 Jul 2013 09:32 AM
I had a feeling I needed parent. Can I use :IsA? To check if its also a model.

Question, I never studied GetPlayerFromCharacter, but what does It exactly do and what did you do?
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
02 Jul 2013 09:34 AM
game.Players:GetPlayerFromCharacter(CHARACTERHERE)

What it does is get the player that is controlling the character.

For example:

game.Players:GetPlayerFromCharacter(workspace:FindFirstChild("TheAwesomenessDude")

^ That would return my player.
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
02 Jul 2013 09:35 AM
Oops, forgot the closing bracket at the end.

Also, checking if the character is a model would work, however if you had other models in your game, the script would think they are character's as well, so it is not recommended.
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
02 Jul 2013 09:37 AM
What exactly is that needed for?

Also, yeah ik. It's just a test.
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
02 Jul 2013 09:40 AM
GetPlayerFromCharacter?

Well, let's say you wanted to insert an admin GUI when someone stepped on a part.

You would first get their character from the Touched event, right?

But their PlayerGui is inside of their player, not their Character.

So you would need to use GetPlayerFromCharacter() to get the player, and then find the PlayerGui from inside that, and then finally clone the admin GUI from lighting (or wherever you have it), and put it inside the PlayerGui.

All from the touch of a brick.
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
02 Jul 2013 09:42 AM
Omg. It all makes sense to me now. I thought 'twas useless. Shanks :3
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