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
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
|
| 16 Jun 2014 05:18 PM |
game.Players:GetPlayerFromCharacter(hit.Parent)
siggys r stupid |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
| |
|
|
| 16 Jun 2014 05:20 PM |
| Am I really the only one who uses game.Players:FindFirstChild(argument.Parent.Name)? |
|
|
| Report Abuse |
|
|
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 |
|
|
| |
|
|
| 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 |
|
|