This sctipt is for when the generator dies then it is removed
z = script.Parent
backup = z:clone()
z.Touched:Connect(function(hit)
while true do
wait(5)
if z.Generator.Health == 0 then
z:Remove()
end
if z == nil then
wait(4)
z:Remove()
end
end

2 comments
replace Remove() with Destroy(), remove is deprecated, this will cause severe lag because over 1000 threads will be created if the player steps on the z part. Also your z.Generator.Health might be localized, keep that in mind..
thx