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 » Scripters
Home Search
 

Re: Punch script kills it's own character?

Previous Thread :: Next Thread 
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
10 May 2015 09:13 PM
So I have this line of code that checks for certain things when punching:

if debounce and canPunch and not hit.Parent ~= script.Parent and hit.Name ~= "Handle" and hit.Parent:FindFirstChild("Humanoid") ~= nil and hit.Parent.Humanoid.Health > 0 then

and sometimes, when the player punches they kill themselves. I absolutely hate part collision checking. Can anyone tell me what it wrong with that line? (I know it's that line because it's the only thing that I'm checking.)
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
10 May 2015 09:23 PM
By the way, the script is a server script inside the character with filteringenabled on.
Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
10 May 2015 09:24 PM
Add an exception for when the punch tool hits the localplayer.
Report Abuse
socccerstar is not online. socccerstar
Joined: 23 Aug 2008
Total Posts: 489
10 May 2015 09:26 PM
You have not hit.Parent ~= script.Parent

That's a double negative, its the equivalent of saying

hit.Parent == script.Parent

Meaning it will only kill people if the "punched" person is the puncher.

Change it to either

not hit.Parent == script.Parent

or

hit.Parent ~= script.Parent

That should fix that part of the problem.
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
10 May 2015 09:26 PM
Player is an abstract object. It can't be touched.
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
10 May 2015 09:27 PM
Omg, see it's tiny things like that I miss... Thank you.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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