generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: hurts humans?

Previous Thread :: Next Thread 
1Ra is not online. 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
matt1020304050 is not online. matt1020304050
Joined: 24 May 2008
Total Posts: 4475
29 Jul 2011 02:03 PM
It shouldn't.
Report Abuse
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
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 is not online. 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 is not online. 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
matt1020304050 is not online. matt1020304050
Joined: 24 May 2008
Total Posts: 4475
29 Jul 2011 02:11 PM
What does having brackets change?
Report Abuse
xvgigakid is not online. 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 is not online. 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
matt1020304050 is not online. matt1020304050
Joined: 24 May 2008
Total Posts: 4475
29 Jul 2011 02:13 PM
Since when, that statement never applied when I used to have ROBLOX installed.
Report Abuse
xvgigakid is not online. 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
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
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 is not online. xvgigakid
Joined: 22 Jun 2008
Total Posts: 4407
29 Jul 2011 02:20 PM
Youve just stated Zombie exists...
Report Abuse
SoulStealer9875 is not online. SoulStealer9875
Joined: 20 Jul 2009
Total Posts: 13119
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
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
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
SoulStealer9875 is not online. SoulStealer9875
Joined: 20 Jul 2009
Total Posts: 13119
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
SoulStealer9875 is not online. SoulStealer9875
Joined: 20 Jul 2009
Total Posts: 13119
29 Jul 2011 02:24 PM
Lemme help you out,

if Hit.Parent:FindFirstChild("Zombie"):IsA("Humanoid") and wait() then
Report Abuse
xvgigakid is not online. 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
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
29 Jul 2011 02:26 PM
No no, I got 2 errors:

"=" and "Zomebie"

to

"==" and "Zombie"
Report Abuse
Fredfishy is online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image