Introduction.
Custom Command is one of the best features of Product: exe. You can create different types of commands that do different things like setting the time to dawn, clearing your friend’s accessories, or making the server go blind by making the environment as bright as white.
Currently, you can choose and combine between these types of what we call “Procedures”;
Plain
The Plain is the most basic procedure out of all. It doesn’t require anything other than just a click of the execute button.
Input
The Input also known as the Textbox procedure lets you type. There are 3 types of this procedure; none, number, and string. “none” lets you type either numerical or non-numerical characters, “number”, lets you type numerical characters, and “string” lets you type non-numerical characters.
Player
The Player procedure lets you choose a player for your command.
Slider
The Slider procedure lets you set a minimum and maximum value. You can also configure the increment and the default value.
Input, Player, and Slider can be combined to fit your arguments for your custom commands.
Tutorial.
After setting up Product: exe, you can now go ahead and create custom commands. Go to ReplicatedStorage
and proceed to exe_storage
inside it, you will find the module named custom_commands
. This is the place where you first set up your custom commands.
To create a new one, copy the code block below and paste it in the module.
["Command Name"] = {
["ICON"] = "rbxassetid://";
["DESCRIPTION"] = "Description goes here...";
["EVENT"] = events.custom_command_events.event;
["PROCEDURE"] = {
["INPUT_MENU"] = false;
["INPUT_SETTINGS"] = "none";
["PLAIN_MENU"] = true;
["PLAYER_MENU"] = false;
["SLIDER_MENU"] = false;
["SLIDER_DEFAULT"] = 1;
["SLIDER_INCREMENT"] = .1;
["SLIDER_SETTINGS"] = NumberRange.new(0, 10);
};
["TIER"] = 1
};
Custom Command Creation.
Let’s create a command where I can edit the player’s cash value. I’m going to name it “Cash Changer”.
Properties | Description | Type |
---|---|---|
NAME | The name of your command. | string |
ICON | The image of your command. | string |
DESCRIPTION | The description of your command. | string |
EVENT | The event to fire when executed. | instance |
Properties | Description | Type |
INPUT_MENU | Allows you to type. | boolean |
INPUT_SETTINGS | “none”, “number”, “string” | string |
PLAIN_MENU | Just an execute button. | boolean |
PLAYER_MENU | Allows you to select players on the server. | boolean |
SLIDER_MENU | Allows you to slide in between values. | boolean |
SLIDER_DEFAULT | The default value of the slider. | number |
SLIDER_INCREMENT | How much it changes every slide. | number |
SLIDER_SETTINGS | The minimum and maximum value. | NumberRange |
Since we’re making a cash changer command, I decided to use the INPUT_MENU
and combine it with the PLAYER_MENU
. I also set the INPUT_SETTINGS
to “number” just because we don’t need anything else other than just numbers.
If the event you linked to the EVENT
property is RemoteEvent
then you need to access it from the server, so you can only use the Script
object. However, if the event you linked is BindableEvent
then you need to access it from the client, so you can only use LocalScript
.
In this tutorial, we will create a new Script
. Since Changing Cash Value is going to be handled on the server, we’ll use Script
.
I just created a script and let’s head inside it.
local players = game:GetService("Players")
local replicated_storage = game:GetService("ReplicatedStorage")
local cash_event = replicated_storage.RemoteEvent --the RemoteEvent I linked to the event property
I created a few variables related to our command.
local players = game:GetService("Players")
local replicated_storage = game:GetService("ReplicatedStorage")
local cash_event = replicated_storage.RemoteEvent
cash_event.OnServerEvent:Connect(function(player, recipient, value) --this means the command is executed
local cash_value = recipient.leaderstats.Cash
cash_value.Value = value
end)
We’re done with the script now! The command should now be listed and executable
in-game.
Player, Input, Slider procedure has returns that you need to acknowledge;
cash_event.OnServerEvent:Connect(function(player, recipient, value)
Those are the recipient
and value
. Since we used the Player and Input procedure, if the command is executed then it will return the Chosen Player and the Text in the Textbox.
Why didn’t you acknowledge the player
?
→ If you used RemoteEvent
there’s a default return of the player
object. This object refers to the player who executed the command. There’s no return of the player
object in BindableEvent
.
If you combine procedures, think of this priority list;
Priority | Procedure |
---|---|
1 | Player Procedure (recipient) |
2 | Input Procedure (value) |
3 | Slider Procedure (slider) |
The list tells us what returns first and what returns last. So if we take that list into scripting (example)
example_event.OnServerEvent:Connect(function(player, recipient, value, slider)
You can see how I arranged the returns. I put the recipient first and put the slider last because the priority tells us that the slider is the last one to return.
This priority list is important. Always keep this in mind when scripting your command. Not doing so, will lead to error.
We are done! Try it now, your command should look like this in-game.
You reached the end! Hopefully, you can now create your custom commands!
Thank you for using Exe!
Having troubles? DM @blve_hxrizon or Join our community.