I have a kick command like so:
CommandsTable.kick = function(...)
local args = {...}
for _, v in pairs(args) do
print(v )
end
print("Getting the targeted player and the reason!")
local TargetedPlayer = args[1][2]
print(TargetedPlayer)
local foundPlayer = FunctionsTable.FindClosestMatch(TargetedPlayer)
if foundPlayer then
local reason
for i = 3, #args do
reason = reason.." "..args[1][i]
end
foundPlayer:Kick(reason)
else
warn("Couldn't find player "..TargetedPlayer)
return
end
end
It identifies the player but it is unable to kick the player for the specified reason. I tried something different by allowing unlimited parameters, so maybe my new exposure to such things is the main reason why I am failing.
Server Script:
local ReturnedTable = Config.Functions.BreakupMessage(Message)
for _, SplitPart in pairs(ReturnedTable) do
print(SplitPart)
end
local RequestedCommand = string.lower(Prefix..ReturnedTable[1])
print(Player.Name.." said: "..ReturnedTable[1])
local CommandFound, Result = pcall(function()
CommandTable[string.lower(ReturnedTable[1])](ReturnedTable)
end)
if CommandFound then
print("Found Command")
else
warn(Result)
end
There are no errors, for the server script code I realise it is malformed but I simply just copy and pasted part of the code, anything else is irrelavant.
Thanks!
Btw the output:
**Server - ChatHandlingScript:17
17:05:41.777 ▼ {
[1] = "kick",
[2] = "really",
[3] = "being",
[4] = "irresponsible",
[5] = "good",
[6] = "riddance",
[7] = "to",
[8] = "bad",
[9] = "nonsense"
} - Server - Config:35
17:05:41.779 Getting the targeted player and the reason! - Server - Config:37
17:05:41.780 really - Server - Config:39
17:05:41.783 Found Command - Server - ChatHandlingScript:22
17:05:41.787 Server Kick Message: - Studio ** --Should be "being irresponsible good riddance to bad nonsense" lol kinda random tho