Hello, I'm making a model with Touched And TouchEnded to set a value to true or false, then it fire projectiles, but everytime that the enemy dies and fire the TouchEnded function, this happens:
17:52:29.469 - Workspace.Model.Touch:9: attempt to index field 'Parent' (a nil value)
Script:
function OnTouch(Hit) local Check = Hit.Parent:FindFirstChild("Zombie") if Check then script.Parent.Value.Value = true end end function OnTouchEnded(Hit) local Check = Hit.Parent:FindFirstChild("Zombie") if Check then script.Parent.Value.Value = false end end script.Parent.Part1.Touched:connect(OnTouch) script.Parent.Part1.TouchEnded:connect(OnTouchEnded)
If theres any way to solve it, Please tell me. Thanks!
PS: The enemy gets removed when her Died function fires, then that happens.