johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 05 Jul 2012 10:54 PM |
script.Parent.Touched:connect((function)
end) where do i put hit so i can do something like p = hit.Parent:getPlayerFromCharacter(hit.Parent) |
|
|
| Report Abuse |
|
|
SwiftE
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 2944 |
|
|
| 05 Jul 2012 10:56 PM |
I guess it goes with the string???? Im not sure. |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 05 Jul 2012 10:56 PM |
Nvm also, correction script.Parent.Touched:connect(function(hit) end) |
|
|
| Report Abuse |
|
|
WhiteRain
|
  |
| Joined: 24 Apr 2010 |
| Total Posts: 2723 |
|
|
| 05 Jul 2012 11:04 PM |
If you format it like this then the Event fires an anonymous function which doesn't require a name.:
script.Parent.Touched:connect(function(hit) --[[code]]-- end)
However if you wish to do it like this you do need to provide a name but I personally prefer the first method over this one:
function onTouched(hit) --[[code]]-- end script.Parent.Touched:connect(onTouched)
As you see in the second one the function is named onTouched and this really doesn't affect the code. You could have named it poop or even aethaen and it wouldn't matter as long as it was called in the connection line. |
|
|
| Report Abuse |
|
|
WhiteRain
|
  |
| Joined: 24 Apr 2010 |
| Total Posts: 2723 |
|
|
| 05 Jul 2012 11:07 PM |
And for what you want, do this:
script.Parent.Touched:connect(function(hit) char = hit.Parent player = game.Players:GetPlayerFromCharacter(char) end) |
|
|
| Report Abuse |
|
|
WhiteRain
|
  |
| Joined: 24 Apr 2010 |
| Total Posts: 2723 |
|
| |
|