I have an admin script, and for some strange reason the kill command does not work.
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
-- Reset Command
function commandTable.reset(message, player)
player.Character:BreakJoints()
end
-- Rejoin Command
function commandTable.rejoin(message, player)
game:GetService("TeleportService"):Teleport(game.PlaceId, player)
if player.Character ~= nil then
player.Character:remove()
end
end
-- Kill Command
function commandTable.kill(message, player)
victim = findPlayer(message:sub(6))
if victim and victim.Character then
victim.Character:BreakJoints()
end
end
game.Players.PlayerAdded:connect(function(player)
if Admins[tostring(player.UserId)] then
player.Chatted:connect(function(message)
if message:sub(1,1) == prefix then
message = message:sub(2, #message)
if commandTable[message] then
commandTable[message](message, player)
end
end
end)
end
end)

3 comments
Do not just post code: explain the reasoning behind your answer. What was wrong before? What did you do to fix it? What were the change(s)? Your answer is vague.
I'm the one who asked the question.
Try looking before downvoting,