How would I make a admin command to behead some one

I don’t really have an idea on how to find people when in Chat. for example:

game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
(Maybe it would be if playermatches leaderboard. I don’t know, I have no idea)

But what I’m trying to do is make a Admin Command Any help would be great!

I would suggest using HDAdmin commands and learning the API. You can find that here. You’ll learn a lot and become and good programmer. Now, to actually do this, you’ll need to simply delete the head part from the character. This can be done as follows:

local playerToBehead = somePlayer
local character = playerToBehead.Character
local head = character:FindFirstChild("Head")

head:FindFirstChild("NeckWeld"):Destroy()
1 Like

I believe he wants a custom admin system.

1 Like

“Command”, not hard-coded like you do.

I would use the message “:Behead player_name”

game.Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:Connect(function(msg)
		local message = string.sub(msg, 1, 9)
		if message == ":Behead " then return end
		local player_name = string.sub(msg, 9, #msg)
		print(player_name)
		assert(game.Players:FindFirstChild(player_name))
			local player = game.Players:FindFirstChild(player_name)
			local char = player.Character or player.CharacterAdded:Wait()

			char.Head:Destroy()
	end)
end)

Updated it, and tested, it works!
This removes the command from the text, then references the player’s name.

local beheadCommand = "/behead"

game.Players.PlayerAdded:Connect(function(player)
    player.Chatted:Connect(function(msg)
	if message:sub(1, beheadCommand:len()):lower() == beheadCommand then
            local char = player.Character
            local head = character:FindFirstChild("Head")
            
            head:FindFirstChild("NeckWeld"):Destroy()
        end
    end)
end)

Something like this would probably work (untested).

I’d recommend using string.split as it was meant for commands.

It worked! Thank you. This will help me alot!