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: I need help with a kill script.

Previous Thread :: Next Thread 
Dashspin is not online. Dashspin
Joined: 05 Aug 2010
Total Posts: 6152
15 Jul 2012 06:26 PM
I'm trying to edit a kill script so it doesn't effect zombies but it won't work. It just doesn't do anything. Doesn't work on the player OR the zombie. My hunch is that I did something wrong. Tell me how to fix it, please.

function onTouched(hit)
if not hit or not hit.Parent then return end
local human = hit.Parent:findFirstChild("Humanoid")
if human and human:IsA("Humanoid") then
human:takeDamage(100)
if hit.Parent == ["Zombie"] nil then -- this is the only line I changed
end
end

It worked before I added that one line. What did I do wrong? Fix it for me please.

Report Abuse
NineOfSpades is not online. NineOfSpades
Joined: 31 Jul 2011
Total Posts: 5326
15 Jul 2012 06:30 PM
Well, for one, you put two "if"s. Elseif is better. :D
Report Abuse
Dashspin is not online. Dashspin
Joined: 05 Aug 2010
Total Posts: 6152
15 Jul 2012 06:31 PM
Okay so I just need to change the second if to elseif? Okay, thanks.
Report Abuse
NineOfSpades is not online. NineOfSpades
Joined: 31 Jul 2011
Total Posts: 5326
15 Jul 2012 06:32 PM
Most likely more than that. I can't concentrate.
Report Abuse
NineOfSpades is not online. NineOfSpades
Joined: 31 Jul 2011
Total Posts: 5326
15 Jul 2012 06:33 PM
What is this line for?

if not hit or not hit.Parent then return end
Report Abuse
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
15 Jul 2012 06:35 PM
Get rid of the line you used and use something such as `local human = hit.Parent:FindFirstChild("Humanoid") or hit.Parent:FindFirstChild("Zombie")`, which will try to find a humanoid named `Zombie` if a `Humanoid` isn't found.

I think this is what you're trying to do anyways.
Report Abuse
Dashspin is not online. Dashspin
Joined: 05 Aug 2010
Total Posts: 6152
15 Jul 2012 06:36 PM
I have no idea. I just copied the script from ROBLOX's stamper spikes and added a line. XD
Report Abuse
Dashspin is not online. Dashspin
Joined: 05 Aug 2010
Total Posts: 6152
15 Jul 2012 06:42 PM
@Scar Adding one of those lines would find the zombie, but I want it to remove the effects of the kill script for the zombie.
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