RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"make it so if Humanoid health = 0 then stop the entire script"
local humanoid = script.Parent:WaitForChild("Zombie") local animation = humanoid:LoadAnimation(script:WaitForChild("Attack")) local cooldown = false for _, child in ipairs(script.Parent:GetChildren()) do if child:IsA("MeshPart") then child.Touched:Connect(function(otherPart) local player = game.Players:GetPlayerFromCharacter(otherPart.Parent) if player and not cooldown then local playerHumanoid = player.Character:FindFirstChild("Humanoid") if playerHumanoid then cooldown = true animation:Play() playerHumanoid.Health = playerHumanoid.Health - 2 if playerHumanoid.Health <= 0 then script.Disabled = true end wait(2.1) cooldown = false end end end) end end