1Ra
|
  |
| Joined: 02 May 2010 |
| Total Posts: 2400 |
|
|
| 29 Jul 2011 02:01 PM |
if Hit then m = game.Players:getPlayerFromCharacter(User) if Hit.Parent:FindFirstChild("Zombie")~=nil then Hit.Parent.Zombie:TakeDamage(30) if Hit.Parent.Zombie.Health<=0 then m.leaderstats.Money = m.leaderstats.Money +100 end
end end
this script tends to hurt humans Why? |
|
|
| Report Abuse |
|
|
| |
|
|
| 29 Jul 2011 02:08 PM |
I believe TakeDamage is a humanoid method (correct me if I'm wrong).
if Hit then m = game.Players:getPlayerFromCharacter(User) if Hit.Parent:FindFirstChild("Zombie",true) then Hit.Parent.Zombie.Health = Hit.Parent.Zombie.Health -30 if Hit.Parent.Zombie.Health<=0 then m.leaderstats.Money = m.leaderstats.Money +100
end end end
|
|
|
| Report Abuse |
|
|
xvgigakid
|
  |
| Joined: 22 Jun 2008 |
| Total Posts: 4407 |
|
|
| 29 Jul 2011 02:08 PM |
Dats because... BRACKETS!
if (Hit.Parent:FindFirstChild("Zombie")~=nil) then Jeez this is a reoccouring problem on the SH forum... |
|
|
| Report Abuse |
|
|
xvgigakid
|
  |
| Joined: 22 Jun 2008 |
| Total Posts: 4407 |
|
|
| 29 Jul 2011 02:09 PM |
@Mario
Zombie's className IS Humanoid. No matter what you rename Humanoid it will always be, A HUMANOID! Logic is Win. |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2011 02:11 PM |
| What does having brackets change? |
|
|
| Report Abuse |
|
|
xvgigakid
|
  |
| Joined: 22 Jun 2008 |
| Total Posts: 4407 |
|
|
| 29 Jul 2011 02:12 PM |
| If you dont include the brrackets the statement will ALWAYS state true. |
|
|
| Report Abuse |
|
|
1Ra
|
  |
| Joined: 02 May 2010 |
| Total Posts: 2400 |
|
|
| 29 Jul 2011 02:13 PM |
using brackets broke the script,
mariostar6464's still had an effect on the human shooting the gun. |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2011 02:13 PM |
| Since when, that statement never applied when I used to have ROBLOX installed. |
|
|
| Report Abuse |
|
|
xvgigakid
|
  |
| Joined: 22 Jun 2008 |
| Total Posts: 4407 |
|
|
| 29 Jul 2011 02:15 PM |
@1RA
Where exactly did you put the brackets. I just tested this out and it works fine. |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2011 02:17 PM |
if Hit then m = game.Players:getPlayerFromCharacter(User) if Hit.Parent:FindFirstChild("Zombie",true) then if Hit.FindFirstChild("Zombie"):IsA("Humanoid") and Hit.FindFirstChild("Zombie").Name = "Zomebie" then --not really needed but give it a try :/ Hit.Parent.Zombie.Health = Hit.Parent.Zombie.Health -30 if Hit.Parent.Zombie.Health<=0 then m.leaderstats.Money = m.leaderstats.Money +100
end end end
|
|
|
| Report Abuse |
|
|
xvgigakid
|
  |
| Joined: 22 Jun 2008 |
| Total Posts: 4407 |
|
|
| 29 Jul 2011 02:20 PM |
| Youve just stated Zombie exists... |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2011 02:21 PM |
"if Hit.FindFirstChild("Zombie"):IsA("Humanoid") and Hit.FindFirstChild("Zombie").Name = "Zomebie" then"
I can two errors there. |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2011 02:23 PM |
Lawl, and I can solve them.
if Hit.FindFirstChild("Zombie"):IsA("Humanoid") and Hit.FindFirstChild("Zombie").Name == "Zombie" then |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2011 02:23 PM |
"if Hit.FindFirstChild("Zombie"):IsA("Humanoid") and Hit.FindFirstChild("Zombie").Name == "Zombie" then"
I can see one more error. |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2011 02:24 PM |
Lemme help you out,
if Hit.Parent:FindFirstChild("Zombie"):IsA("Humanoid") and wait() then |
|
|
| Report Abuse |
|
|
xvgigakid
|
  |
| Joined: 22 Jun 2008 |
| Total Posts: 4407 |
|
|
| 29 Jul 2011 02:25 PM |
Youve only solved one error.
@Soul What happened to being evil on the SH forum? And nice to see your account is unbanned. |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2011 02:26 PM |
No no, I got 2 errors:
"=" and "Zomebie"
to
"==" and "Zombie" |
|
|
| Report Abuse |
|
|
Fredfishy
|
  |
| Joined: 21 Mar 2009 |
| Total Posts: 4197 |
|
|
| 29 Jul 2011 02:35 PM |
| @xv, brackets are not needed. In other languages like C++, yes. Not in RBX.Lua though. |
|
|
| Report Abuse |
|
|