im trying to do a custom command that allow me to change players race just typing "race PlayerName RaceValue" in the command bar, im using kohls admin, but it just dont work, say its waiting a number and im giving a string. the path for "race string" is: "game.Players.Player.Stats.Race.Value"
22:22:16.720 Kohl's Admin Infinite Error: ServerScriptService.Kohl's Admin Infinite.Custom Commands:39: invalid 'for' initial value (number expected, got string) - Studio this is wt it says my code is this:
{{'Race'},{'Change the Race of the Player','Race Player Value'},5,{'player','string'},function(pl,args) for i=args[2],0,-1 do for _, player in pairs(args[1]) do player:WaitForChild("Stats").Race.Value = args end end end}
wt am i doing wrong?
If you're using a proper command system then args will be the arguments of the command.
So for example if you type /command abc def
then args[1]
will be abc
and args[2]
will be def
(you separate them with a space)
Also note that in most programming languages args[0]
would be abc
but LUA is different
Args will always be string, it's just text that you type in chat. But if you're sure there's a number in there, you can use tonumber(args[2])
.
I don't exactly know how to use these custom commands, but I believe it might be because args[2]
is a string, and it needs to be a number instead.