Adding wait, glitches the script, in giving an error for the next line of code??
Asked by
5 years ago Edited 5 years ago
So I have this script, thats a part of my sword. The damage and animation are a little off, so I wanted to add a wait to the damage part. I added it, then it gives an error, for the next line of code. I take it away, and it works perfectly fine. I have no idea why, this has never happened to me before. This is the error 19:52:34.046 - Players.Wilbyte.Backpack.Stick.Script:16: attempt to index field 'Parent' (a nil value). Code:
02 | script.Parent.Handle.Touched:Connect( function (p) |
03 | if CanDamage = = true then |
04 | if p.parent:FindFirstChild( "Zombie" ) then |
06 | p.Parent.Zombie:TakeDamage( 20 ) |