|
| 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 |
|
|
|
| 10 May 2015 09:23 PM |
| By the way, the script is a server script inside the character with filteringenabled on. |
|
|
| Report Abuse |
|
|
|
| 10 May 2015 09:24 PM |
| Add an exception for when the punch tool hits the localplayer. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 10 May 2015 09:26 PM |
| Player is an abstract object. It can't be touched. |
|
|
| Report Abuse |
|
|
|
| 10 May 2015 09:27 PM |
| Omg, see it's tiny things like that I miss... Thank you. |
|
|
| Report Abuse |
|
|