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 Character via ClickDetector?

Previous Thread :: Next Thread 
SkateBored is not online. SkateBored
Joined: 11 Aug 2009
Total Posts: 302
15 Jul 2013 07:34 PM
I'm making an elevator, and I want to make it so you can click a panel to open a GUI that lets you change the floors. The problem is, I can't access the Character or Player from that thus I can't access the PlayerGui with the GUI panel in it.
How do I access the character (all I need is the character's name) by clicking the button?

~SkateBored, CEO and Founder of Cloud Nine Incorporated.
Report Abuse
Unsubstantial is not online. Unsubstantial
Joined: 11 Sep 2012
Total Posts: 872
15 Jul 2013 07:37 PM
script.Parent.ClickDetector.MouseClick:connect(function(char)
print(char.Name)
--code bleughhhh
game.Players[char.Name]:remove()
--how to get to player
end)
Report Abuse
foreverpower is not online. foreverpower
Joined: 05 Feb 2011
Total Posts: 5578
15 Jul 2013 08:12 PM
To get a player you should use

game.Players:GetPlayerFromCharacter(character)

Or for this script

script.Parent.ClickDetector.MouseClick:connect(function(clicked)

local char = clicked.Parent


local player = game.Players:GetPlayerFromCharacter(char)

end)
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
15 Jul 2013 08:16 PM
ClickDetector.MouseClick:connect(function(PlayerWhoClicked)
print(PlayerWhoClicked)
if PlayerWhoClicked.Character then
print("The player that clicked has a character!")
print("Killing that character now...")
PlayerWhoClicked.Character:BreakJoints()
end
end)
Report Abuse
MemoryAddress is not online. MemoryAddress
Joined: 20 Apr 2013
Total Posts: 1297
15 Jul 2013 08:24 PM
[ Content Deleted ]
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