script.Parent.MouseButton1Click:Connect(function() -- Find nearest enemy (only works for NPCs/your own game's enemies) local enemies = workspace:FindFirstChild("Enemies") if enemies then for _, enemy in pairs(enemies:GetChildren()) do if enemy:FindFirstChild("Humanoid") then local distance = (enemy.HumanoidRootPart.Position - character.HumanoidRootPart.Position).Magnitude if distance < 10 then enemy.Humanoid.Health = 0 end end end end end)
Would you like help learning how to create actual working combat systems for your own Roblox game instead? fe roblox kill gui script full
If you're interested in Roblox scripting for legitimate purposes (like creating your own games with combat systems), here's a proper example of a local kill GUI that works on enemies/NPCs you control in your own game: script