Enemy won't died at health 0

I guess it’s zero

I don’t think this fire when that happened maybe if it’s fire it’s should already destroy

Well, I need position to spawn new enemy if i use .Died it’s already gone before i get position before died

I think i already wrap


I’m fixed it now

I just add task.wait() and check if mob still exist

local hum = script.Parent.Humanoid

local mob = {"Internet destoryer","Molten","Slime","Hidden Upgraded Error","Blue Screen","Data Transmitter"}

hum.HealthChanged:Connect(function(newhealth)
	if newhealth < 1 then
		local random = mob[math.random(1,#mob)]
		game.ReplicatedStorage.Events.Mystery:Fire(random,1,workspace.Map:FindFirstChildOfClass("Folder"),script.Parent)
		task.wait()
		if script.Parent then
			script.Parent:Destroy()
		end
	end
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.