RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"Create a script that destroys a part when a player kills a certain amount of NPCs"
-- server script local part = game.Workspace.PartToDestroy local npcKillCount = 0 local requiredKills = 5 game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) local humanoid = character:WaitForChild("Humanoid") humanoid.Died:Connect(function() if humanoid.Health == 0 and humanoid.Parent.Name == "NPC" then npcKillCount = npcKillCount + 1 if npcKillCount >= requiredKills then part:Destroy() end end end) end) end)