Skip to content
This repository has been archived by the owner. It is now read-only.
Joshua Lanese edited this page Aug 2, 2017 · 5 revisions

roblox-js Wiki

Welcome to the roblox-js Wiki, it's recommended you get started by understanding how the module functions which is covered on the usage page. From there you can look at the API for the module's main functions, utility functions, and event functions.

Here is the format for the API:

example function: name

argument 1, argument 2/other argument 2[, optional argument 1, optional argument 2]

Description. When calling functions without an options object and you come across a multi argument (argument 2 or other argument 2) argument 2 will be used. The only way to get other argument 2 is by using an options object and specifying the name.

Arguments

  • argument name (argument type)
    • structure (for objects)
    • index (index type)

Returns (type)

  • structure (for objects)

Cookie jars are always optional, if one isn't specified the function will automatically use the default global cookie jar.


As an example, here is the setRank API and usage of it:

setRank

group, target, rank/roleset/name[, jar]

Promotes player with userId target in group with groupId group to rank rank, roleset roleset, or name name. One is required but not all, use roleset to speed up requests and name if there are ambiguous ranks (same rank number). If a rank or name was passed the corresponding role will be returned.

Arguments

  • group (number)
  • target (number)
  • either rank (number)
  • or roleset (number)
  • or name (string)
  • optional jar (CookieJar)

Returns

(Promise)

  • newRole (Object)
    • NOTE: If the function was called directly with a roleset only ID is present
    • Name (string)
    • Rank (number)
    • ID (number)

You can of course call the functions directly with arguments as so:

rbx.setRank(18, 2470023, 10)
.then(function (newRole) {
  console.log('The new role is: ' + JSON.stringify(newRole));
});

This will use the groupId 18 and promote the user with userId 2470023 to rank 10. Although rank is the default if you only use arguments, rank can also be replaced by rank name or roleset ID if you use the options object. For example:

var options = {
  group: 18,
  target: 2470023,
  name: 'Initiate'
}

rbx.setRank(options)
.then(function (newRole) {
  console.log('The new role is: ' + JSON.stringify(newRole));
});

You can then append the optional argument jar as either a direct argument or put it in the options object.

var cookie = rbx.jar();
var options = {
  group: 18,
  target: 2470023,
  rank: 10,
  jar: cookie
}
rbx.setRank(options)
.then(function (newRole) {
  console.log('The new role is: ' + JSON.stringify(newRole));
});
You can’t perform that action at this time.