Okay, I am making an admin script, but on commands, such as rejoin and reset it requires a players name, and I don't want them commands to have that. Only kick and kill should have it. i.e. ;kick mosski123
Here is my code;
local Admins = {
["19498972"] = true,
["1540993"] = true,
["46641586"] = 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("[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)

4 comments
You're only connecting the chatted event to admins. You should connect the chatted event to all and then check if the player is admin when specific commands are run.
That's not the problem...
They don't appear to be set up like that though..? Could you be more specific and clarify about what you're asking?
Basically, I have four commands, but they all require a target player to work. On the commands rejoin and reset, I want them to just be a command and only target the local player.