trogyssy
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 2322 |
|
|
| 01 Mar 2014 05:03 PM |
| Would a function called when a part is touched work if the part being touched has a mesh? |
|
|
| Report Abuse |
|
|
Azureous
|
  |
| Joined: 29 Jan 2012 |
| Total Posts: 25287 |
|
| |
|
trogyssy
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 2322 |
|
| |
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 01 Mar 2014 05:07 PM |
| Yes. It doesn't matter, just don't make the Event go off of the mesh like a moron then you're fine lol. |
|
|
| Report Abuse |
|
|
trogyssy
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 2322 |
|
|
| 01 Mar 2014 05:16 PM |
Yeah ik that -_-
Didn't work though. Here's the script. "Clip" is a NumberValue under the player
function Reload(hit) if hit:FindFirstChild("Humanoid")then local Player=Game.Players:FindFirstChild(hit.Name) if Player then if Player.TeamColor==script.Parent.BrickColor then hit.Humanoid.Health=hit.Humanoid.MaxHealth if Player:FindFirstChild("Clip")then Player.Clip.Value=40 end end end end end script.Parent.Touched:connect(Reload) |
|
|
| Report Abuse |
|
|
trogyssy
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 2322 |
|
| |
|
|
| 01 Mar 2014 05:34 PM |
Oh gawd.. Its not hit:findFirstChild Its hit.Parent:findFirstChild.. |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2014 05:35 PM |
Also FindFirstChild(hit.Parent.Name) Dude,u forgot the parent in like every line |
|
|
| Report Abuse |
|
|
trogyssy
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 2322 |
|
|
| 01 Mar 2014 05:38 PM |
Revised, still don't work:
function Reload(hit) local thing hit.Parent:FindFirstChild("Humanoid") if thing then local Player=Game.Players:FindFirstChild(thing.Parent.Parent.Name) if Player then if Player.TeamColor==script.Parent.BrickColor then hit.Parent.Humanoid.Health=hit.Humanoid.MaxHealth if Player:FindFirstChild("Clip")then Player.Clip.Value=40 end end end end end script.Parent.Touched:connect(Reload)
no errors in output... |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2014 05:42 PM |
Well,your close at least:
function Reload(hit) local thing = hit.Parent:FindFirstChild("Humanoid") if thing then local Player=game.Players:FindFirstChild(hit.Parent.Name) if Player then if Player.TeamColor==script.Parent.BrickColor then hit.Parent.Humanoid.Health=hit.Parent.Humanoid.MaxHealth if Player:FindFirstChild("Clip") then Player.Clip.Value=40 end end end end end script.Parent.Touched:connect(Reload) |
|
|
| Report Abuse |
|
|
| |
|
trogyssy
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 2322 |
|
|
| 01 Mar 2014 08:01 PM |
| Thank you, works like a charm :) |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 01 Mar 2014 09:42 PM |
script.Parent.Touched:connect(function(hit) if hit:FindFirstChild("Humanoid") then local Player = game.Players:FindFirstChild(hit.Name) if (Player ~= nil) then if Player.TeamColor == --Just put the BrickColor. then hit.Parent.Humanoid.Health = 99999 if Player:FindFirstChild("Clip")then Player.Clip.Value = 40 end end end end end)
|
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 01 Mar 2014 09:44 PM |
Sorry typo.
script.Parent.Touched:connect(function(hit) if hit:FindFirstChild("Humanoid") ~= nil then local Player = game.Players:FindFirstChild(hit.Parent) if (Player ~= nil) then if Player.TeamColor == --(Just put the BrickColor.) then hit.Parent.Humanoid.Health = 99999 if Player:FindFirstChild("Clip")then Player.Clip.Value = 40 end end end end end) |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2014 09:45 PM |
@Goul I already answered lul |
|
|
| Report Abuse |
|
|