Back to Scripts
Kill  Command

Kill Command

ScriptBlox
Free

Game: Piggy [HALLOWEEN SKINS]

220 Views
0 Likes
2 Dislikes
RobloxZUOI

RobloxZUOI

offline

Features

Able To Kill People In Server. Local.Player [plr, Name.]

Script Code

-- /kill Command Script for Roblox:D ZuoiRoblox
--Last time this was a fail but now we have a reborn
-- Have fun.
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

-- Command handler
local function handleCommand(input)
	local args = input:lower():split(" ")
	if args[1] == "/kill" then
		if #args == 1 or args[2] == "me" or args[2] == LocalPlayer.Name:lower() then
			Humanoid.Health = 0
			return "Killed yourself"
		else
			local targetName = args[2]
			local target = Players:FindFirstChild(targetName, true)
			if target and target.Character and target.Character:FindFirstChild("Humanoid") then
				target.Character.Humanoid.Health = 0
				return "Killed " .. targetName
			else
				return "Player " .. targetName .. " not found"
			end
		end
	end
	return "Invalid command. Use: /kill [playerName] or /kill me"
end

-- Simple GUI for command input
local function createCommandGui()
	local ScreenGui = Instance.new("ScreenGui")
	ScreenGui.Name = "KillCommandGui"
	ScreenGui.Parent = LocalPlayer.PlayerGui
	ScreenGui.ResetOnSpawn = false

	local Frame = Instance.new("Frame")
	Frame.Size = UDim2.new(0, 200, 0, 40)
	Frame.Position = UDim2.new(0.5, -100, 0, 50)
	Frame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
	Frame.BorderSizePixel = 0
	Frame.Parent = ScreenGui

	local TextBox = Instance.new("TextBox")
	TextBox.Size = UDim2.new(0.9, 0, 0.6, 0)
	TextBox.Position = UDim2.new(0.05, 0, 0.2, 0)
	TextBox.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
	TextBox.TextColor3 = Color3.fromRGB(255, 255, 255)
	TextBox.PlaceholderText = "/kill [player] or /kill me"
	TextBox.Text = ""
	TextBox.Font = Enum.Font.SourceSans
	TextBox.TextSize = 14
	TextBox.Parent = Frame

	TextBox.FocusLost:Connect(function(enterPressed)
		if enterPressed then
			local result = handleCommand(TextBox.Text)
			TextBox.Text = result
		end
	end)
end

-- Initialize and handle character respawn
local function init()
	createCommandGui()
	print("Kill command loaded! Press F9 to toggle GUI. Use: /kill [playerName] or /kill me")
end

init()
LocalPlayer.CharacterAdded:Connect(function(newChar)
	Character = newChar
	Humanoid = newChar:WaitForChild("Humanoid")
end)

-- Toggle GUI with F9
UserInputService.InputBegan:Connect(function(input, gameProcessed)
	if not gameProcessed and input.KeyCode == Enum.KeyCode.F9 then
		local gui = LocalPlayer.PlayerGui:FindFirstChild("KillCommandGui")
		if gui then
			gui.Enabled = not gui.Enabled
		end
	end
end)

Ratings & Reviews

No reviews yet. Be the first to review this script!

Comments (0)

Please login to comment

Login with Discord

Loading comments...