Args[1] is nil?

Hey, im doing a hd admin custom command, and for some reason the first argument is nil, but it does get the speaker

this is my code:

Function = function(speaker, args)
		local size = args[1]
		local map = workspace:WaitForChild("Baseplate")
		print(size)
		print(speaker)
		if not size then return end
		if size == "inf" then
			map.Size = Vector3.new(2048, 16, 2048)
		else
			map.Size = Vector3.new(size, 16, size)
		end
	end;

the output is:

nil  -  Server - Commands:26
elepunto3993  -  Server - Commands:27

Thanks!

What arguments are you passing in when you’re calling this function?
Can you show the bit of code where the function is actually being called?

1 Like

The map size
(e.g. ;Mapsize 100)

And uhh, as is an HD Admin custom command and i didnt edit or do the loader idk where does the function calls…

1 Like

nil means that you didn’t add a value to it or that it doesn’t exist make sure ur passing the correct parameter

[] only works for tables Mapsize is a number not a table

im passing the correct parameter as is just the Args[1]
and the command would be ;mapsize 100 ← args[1] is (100)

can you show the part of the script where you call the function? that will make it more clear

1 Like

Check the Official HD Admin Custom command creation post there is a tutorial where he does Args[1] as the player…

1 Like

.?


1 Like

Can you try printing the args parameter instead of args[1]? What does it return?

1 Like

A blank table.


Looks like your command isn’t passing those arguments in properly, instead just a blank table.

I suggest searching through HD Admins’ system or just re-doing this custom command in case you messed something up.

I’ll try that, thx.


1 Like