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 the "Player"

Previous Thread :: Next Thread 
towmater is not online. towmater
Joined: 05 Jan 2007
Total Posts: 1804
16 Jun 2014 05:17 PM
I'm making a brick that gives the player a GUI, and now I'm stuck.

I don't know how to get the player from "hit"

Anyways, here is my script.

local db = true


script.Parent.Touched:connect(function(hit)
if db and hit.Parent:IsA("Model") then
--code here
end
end)
Report Abuse
robomax11 is not online. robomax11
Joined: 07 Jul 2011
Total Posts: 6828
16 Jun 2014 05:18 PM
game.Players:GetPlayerFromCharacter(hit.Parent)

siggys r stupid
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
16 Jun 2014 05:19 PM
script.Parent.Touched:connect(function(hit)
if game.Players:FindFirstChild(hit.Parent.Name) then --this
local player = game.Players:FindFirstChild(hit.Parent.Name) --this

--stuffs

end
end)
Report Abuse
DeviousDeviation is not online. DeviousDeviation
Joined: 28 Dec 2010
Total Posts: 9306
16 Jun 2014 05:19 PM
local db = true

script.Parent.Touched:connect(function(hit)
if db and hit.Parent:findFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
print(player.Name)
end
end
end)

<^V>
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
16 Jun 2014 05:19 PM
script.Parent.Touched:connect(function(hit)
if db and (hit.Parent) and game.Players:GetPlayerFromCharacter(hit.Parent) then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
--code here
end
end)
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
16 Jun 2014 05:20 PM
1 answer was enough
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
16 Jun 2014 05:20 PM
Am I really the only one who uses game.Players:FindFirstChild(argument.Parent.Name)?
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
16 Jun 2014 05:21 PM
@Sensei, I do too. :) (thought it was just me)
Report Abuse
DeviousDeviation is not online. DeviousDeviation
Joined: 28 Dec 2010
Total Posts: 9306
16 Jun 2014 05:21 PM
@Sensei
Yes

<^V>
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
16 Jun 2014 05:21 PM
@smiley
incase you have not noticed we all posted at the same time

and sensei, I rather use something more built in specifically for that purpose
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