This functionality is only available to roblox-ts users. This is not possible in regular Luau.
A feature that can be leveraged with the power of the roblox-ts compiler, is a thing referred to as "Remote Ids". This is a way to throw off any identifying information about your remotes to any external parties.
If used correctly it should make it quite hard to make exploit tools for your game, and throw off most exploiters.
To start using Remote Ids, first install the Remote Id generation tool:
Then, create a new
remoteIds.id.json file inside your project. It doesn't have to be called
remoteIds, but for this example that's what we're doing. As long as it ends with
Name field is the outputted name of the
const enum, and the
IDs will be the IDs you have for your remotes.
Now lets add some example remote ids
Now that we have some remote ids, we need to generate the
type declaration file. Run the command in your console:
remoteId.d.ts file should have been generated, and should look like the following:
These IDs will change every time you run the
rbxnid command. It's recommended you do this as part of your build process, so each new build of your game has an entirely new set of IDs. This will ensure that it's difficult to make any specific exploit tools for your game.
Then when you have the RemoteIds, you can use them in place where you'd normally supply a remote id:
This will end up compiling to
Using remote ids with definitions is straightforward.
Which should compile to the following: