Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 19 Sep 2011 03:32 PM |
function onTouch(hit) if script.Parent.Parent:FindFirstChild("Handle") nil then
if hit.Parent:FindFirstChild("Humanoid") nil then
if game.Players:FindFirstChild(humanoid.Parent.Name):IsInGroup(72321) true then
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.MaxHealth wait(2) elseif game.Players:FindFirstChild(humanoid.Parent.Name):IsInGroup(72321) false then end end end end
script.Parent.Parent.Touched:connect(onTouch)
Whats wrong with it?
And can you tell me the right source code? |
|
|
| Report Abuse |
|
|
Nagaris
|
  |
| Joined: 18 Sep 2011 |
| Total Posts: 422 |
|
|
| 19 Sep 2011 03:37 PM |
:findFirstChild(What Ever Model Here)
NOT:
:FindFirstChild(What Ever Model Here)
"find" in findFirstChild shouldn't be capitalized.
Also, I am not quite fond of the IsInGroup function, but I think that after the Group ID, there should be an "="
IE: :IsInGroup(72321) = true then |
|
|
| Report Abuse |
|
|
Nagaris
|
  |
| Joined: 18 Sep 2011 |
| Total Posts: 422 |
|
|
| 19 Sep 2011 03:38 PM |
Correction.
:IsInGroup(72321) == true then
I failed.... |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 19 Sep 2011 03:38 PM |
so can you give me the whole source code thats corected?
Just paste it please. |
|
|
| Report Abuse |
|
|
Nagaris
|
  |
| Joined: 18 Sep 2011 |
| Total Posts: 422 |
|
|
| 19 Sep 2011 03:40 PM |
Also, No need for the elseif
Seen as if it only happens IF the user is in the group, then it will only effect said player. So, you can also remove that, and it's end. I will post a revised script in a moment. |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 19 Sep 2011 03:44 PM |
| Thanks for your your help :D |
|
|
| Report Abuse |
|
|
Nagaris
|
  |
| Joined: 18 Sep 2011 |
| Total Posts: 422 |
|
|
| 19 Sep 2011 03:45 PM |
function onTouch(hit)
if script.Parent.Parent:FindFirstChild("Handle") ~= nil and hit.Parent:FindFirstChild("Humanoid") and game.Players:FindFirstChild(humanoid.Parent.Name):IsInGroup(72321) == true then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.MaxHealth wait(2) end
script.Parent.Parent.Touched:connect(onTouch)
(That big chunk at the top should be 1 line.) |
|
|
| Report Abuse |
|
|
Nagaris
|
  |
| Joined: 18 Sep 2011 |
| Total Posts: 422 |
|
|
| 19 Sep 2011 03:46 PM |
Jeeze I messed up... Slightly alter that...
function onTouch(hit)
if script.Parent.Parent:FindFirstChild("Handle") ~= nil and hit.Parent:FindFirstChild("Humanoid") ~= nil and game.Players:FindFirstChild(humanoid.Parent.Name):IsInGroup(72321) == true then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.MaxHealth wait(2) end
script.Parent.Parent.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 19 Sep 2011 03:46 PM |
| Do I put the script in the gun handle? |
|
|
| Report Abuse |
|
|
Nagaris
|
  |
| Joined: 18 Sep 2011 |
| Total Posts: 422 |
|
|
| 19 Sep 2011 03:48 PM |
| well... I didn't exactly know what the script was in.. That would work though... if the variables were assigned properly. |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
| |
|