This is for when the generator dies the parent is destroyed
if script.Parent.Generator.Health <= 0
then
script.Parent:Destroy()
end
This is for when the generator dies the parent is destroyed
if script.Parent.Generator.Health <= 0
then
script.Parent:Destroy()
end
This is because it only runs once, when the server first boots up. You should do:
while true do
if script.Parent.Generator.Health <= 0 then
script.Parent:Destroy()
end
wait()
end
edit: if someone sees this, the comment's reply is actually the more "correct" answer. try
script.Parent.Generator:GetPropertyChangedSignal("Health"):Connect(function()
if script.Parent.Generator.Health <= 0 then
script.Parent:Destroy()
end
end)
this will run more efficiently
thx ill try it
Or script.Parent.Generator.Health:GetPropertyChangedSignal("Helath"):Connect(function() because then you don't need the loop
Thx it worked
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Yes add a while loop