I am attempting to make my own admin script. I have a command set up to kill a specified player, which works and all, but I have also set it up so if the second word is equal to 'me' then it will kill the player who sent the message.
It works if I put another player's name, but not if I put 'me', I believe it is something to do with the string.sub, as I don't really know how to use it properly. I have no errors in the output. Any help is appreciated, thanks.
local Admins = {
["19498972"] = true,
}
local prefix = ";"
local commandTable = {}
function findPlayer(name)
for _, player in ipairs(game.Players:GetPlayers()) do
if player.Name:lower() == name:lower() then
return player
end
end
end
function commandTable.kill(message, player)
if string.sub(message, 7, 8) == "me" then
player.Character:BreakJoints()
else
victim = findPlayer(message)
if victim and victim.Character then
victim.Character:BreakJoints()
end
end
end
game.Players.PlayerAdded:Connect(function(player)
if Admins[tostring(player.UserId)] then
player.Chatted:Connect(function(message)
local command, argument = message:match(prefix.."(.+) (.+)")
if command and commandTable[command] then
commandTable[command](argument, player)
end
end)
end
end)
The error, I believe is on line 17.

4 comments
PM me on ROBLOX, I can just give you an admin script of mine. It has a lot of fancy features, and it doesn't require you to count string.sub and stuff.
Make sure you message me on the account "D3D9", it's my new main. Follow to message me.
No thank you. The reason I am here is to fix my bugs, so I can learn about it. I don't want any free scripts or models. It defeats the point of my question and this websites purpose.
Posting a reply any moment, testing out the Script first