So im taking a zombie survival game and when i die then zombies just stack on my dead parts position. (And dont tell me about path finding and all that stuff cus i know that i can use that)
Heres the zombie script:
script.Parent.Touched:Connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent) then
if script.Parent.Parent.Humanoid.Health ~= 0 then
hit.Parent.Humanoid.Health = 0
wait(0.3)
local plr = game.Players:FindFirstChildOfClass("Player")
local Hum = game.Workspace:WaitForChild(plr.Name).HumanoidRootPart
while wait() do
script.Parent.Parent.Humanoid:MoveTo(Hum.Position)
end
end
end
end)

1 comment
check if hum's health is not zero in while loop and break it if it is.