Okay and which argument in arguments is the victim?
I don’t think it gets it, all it does is get the player and the argument:
if CommandFunc ~= nil then
CommandFunc(Player,Arguments)
end
Okay and is player the victim then?
Player is the person it is coming from; the admin doing the command. (i’m pretty sure)
So does that mean argument[1] is the victim since you removed argument[1]?
Possibly, i’m not too familiar with this area of coding.
Okay then try printing argument[1] and see what shows up. Then we can carry on from there.
Ok I printed and it printed argument[1] as the victim.
Okay thats good so replace victim in my code with argument[1] and then edit it to fit your game. So is it sorted now?
ServerScriptService.Admin:54: attempt to index nil with ‘lower’
string.sub(Arguments[1].Name:lower(),1,splittedString[2]:len()) then
Nvm I fixed it, it works I think, it just isn’t running any commands.
It is printing the correct names though, just not running the command now.
print (CommandFunc) returns as: function: 0x09fc7c5f9007b8cb
Okay and did the commands work earlier?
No. They just aren’t getting the function for some reason it comes out as that.
Probably because the functions are using the victims full name.
wdym? that was given after i said “:kick…”
Instead of
CommandFunc(Player,Arguments)
try
CommandFunc(Player,unpack(Arguments))
then it would pass all the args unpacked, instead of inside a table.
Also, victim
in the command module functions is a string, so you should make some sort of function to get the player object from the victim
string
Also, you don’t have to do
local CommandName = Arguments[1]
table.remove(Arguments,1)
you can just do
local CommandName = table.remove(Arguments, 1)
because table.remove
returns the element you remove
Also, instead of
local Arguments = {}
for Argument in string.gmatch(Message,"[^%s]+") do
table.insert(Arguments,Argument)
end
you can just do
local Arguments = string.split(Message, " ")
i will do that, can you have it do that?
What do you mean? You want me to write the player finder function?