How I created a Gravity admin command

Hey! I recently created a Gravity admin command.

I have used HD admin, to create this command.

for this I have opened the folder HD admin and have opened the folder Costum Features and in this folder I have opened the folder Server and then I have opened the folder Modules now I have gone into the script commands.

Screenshot HD Admin

now I have used the given settings that are already existing in the script.

{
	Name = "";
	Aliases	= {};
	Prefixes = {settings.Prefix};
	Rank = 1;
	RankLock = false;
	Loopable = false;
	Tags = {};
	Description = "";
	Contributors = {};
	--
	Args = {};
	Function = function(speaker, args)
		
	end;
	UnFunction = function(speaker, args)
		
	end;
	--
	};

Now I started to write the command.

{
Name = "Gravity";
		Aliases	= {};
		Prefixes = {settings.Prefix};
		Rank = 5;
		RankLock = false;
		Loopable = false;
		Tags = {};
		Description = "changes the gravity of the game";
		Contributors = {"YTGamingLama"};
		--
		Args = {"Player"};
		Function = function(speaker, args)
			game.Workspace.Gravity = 70 --The gravity
		end;

if you want to use this command in your game you can also customize the gravity stuffe in line 14. : D
now I have just described the function to stop commands.

UnFunction = function(speaker, args)
		-- sets the gravity to normal
		game.Workspace.Gravity = 196.2 --The gravity
	end;

and now the simple command is already finished here is again the whole script.

{
	Name = "Gravity";
	Aliases	= {};
	Prefixes = {settings.Prefix};
	Rank = 5;
	RankLock = false;
	Loopable = false;
	Tags = {};
	Description = "changes the gravity of the game";
	Contributors = {"YTGamingLama"};
	--
	Args = {"Player"};
	Function = function(speaker, args)
		game.Workspace.Gravity = 70 --The gravity
	end;
	UnFunction = function(speaker, args)
		-- sets the gravity to normal
		game.Workspace.Gravity = 196.2 --The gravity
	end; 
};

I hope you liked this post if yes let me know but if I have done anything wrong in this post tell me then I will change it. : D

4 Likes

sorry at first I forgot how to use code blocks but I have edited the post again I hope it is perfect now.

Cool. You can also add some arguments into Args array so the player can set gravity through command! For example:

Args = {"Player", gravity);

Function = function(speaker, args)
    game.Workspace.Gravity = args[2]
end;
UnFunction = function(speaker, args)
		game.Workspace.Gravity = 196.2
	end; 

So we get the second item of Args array to set the Workspace gravity. Hope this works!

I am very happy that you like the command. :smile: