Idk wut to say Script:
while true do
owner = script.Owner.Value
wait()
if game.Workspace[owner].Humanoid.Health == 0 then
script.Parent.Parent:Destroy()
end
end
Its not working. I really need help!
Idk wut to say Script:
while true do
owner = script.Owner.Value
wait()
if game.Workspace[owner].Humanoid.Health == 0 then
script.Parent.Parent:Destroy()
end
end
Its not working. I really need help!
Instead of doing an infinite loop, I'd use an event listener instead:
if game.Workspace[owner] then --Check if game.Workspace[owner] exists
game.Workspace[owner].Humanoid.Died:connect(function() --Wait until death
script.Parent.Parent:Destroy() --Destroy script.Parent.Parent
end)
end
Thx
Also, in case it doesn't work, I had to edit it to add a parentheses (You might have copied the code without them.)
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
What does "not working" mean? Is there an error?
Well yes. Output says: "Is not a valid member of workspace,"