paulruffy
|
  |
| Joined: 04 Jan 2011 |
| Total Posts: 76 |
|
|
| 28 Apr 2014 11:55 AM |
| How would i say "If a brick is touched by a robloxian then"... "Do something to that robloxian" |
|
|
| Report Abuse |
|
|
|
| 28 Apr 2014 11:56 AM |
brick = workspace.Part
brick.Touched:connect(function(hit) if hit.Parent:findFirstChild("Humanoid") then if game.Players:findFirstChild(hit.Parent.Name) then local robloxian = hit.Parent robloxian.Humanoid.Health = 0 end end end) |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 28 Apr 2014 11:56 AM |
script.Parent.Touched:connect(function(hit) plr=game.Players:findFirstChild(hit.Parent.Name) if plr then --code end end) |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 28 Apr 2014 11:57 AM |
@above, "if hit.Parent:findFirstChild("Humanoid") then" |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 28 Apr 2014 11:58 AM |
...is a pointless line.
(Accidently pressed send - I'm on my phone) |
|
|
| Report Abuse |
|
|
|
| 28 Apr 2014 11:59 AM |
when something touches a brick you can use .Touched to connect function and it also gives you the brick that has touched that brick is usualy robloxians leg so you need to check if it rly is
function onTouch(part2) if game.Players:GetPlayerFromCharacter(part2.Parent)then local player = game.Players:GetPlayerFromCharacter(part2.Parent) --what you want to do here end end
part1.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|