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)
Fixed code;
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.reset(message, player) player.Character:BreakJoints() end function commandTable.rejoin(message, player) game:GetService("TeleportService"):Teleport(game.PlaceId, player) if player.Character ~= nil then player.Character:remove() end end function commandTable.kill(message, player) victim = findPlayer(message) if victim and victim.Character then victim.Character:BreakJoints() end end function commandTable.kick(message, player) victim = findPlayer(message) if victim and victim.Character then victim:Kick(player.Name.." has kicked you from the server.") 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)