Skip to content

ReferenceStates, zones, net events, instances, decals

Crafting ​

Recipes turn items (and money) into other items, at a bench, anywhere, or from your own script. The server checks and swaps everything at once: if the result does not fit in the inventory, nothing has changed.

lua
RLX.AddRecipe({
  id = "lockpick", category = "Tools",                   -- label: the result's label by default
  result = { item = "lockpick", count = 1, metadata = nil },
  ingredients = { scrap_metal = 2, tape = 1 },           -- consumed
  tools = { "screwdriver" },                             -- needed, kept
  money = { money = 50 },                                -- account = amount
  duration = 4000, anim = { dict = "mini@repair", clip = "fixing_a_ped" },   -- or scenario; prop = { model, bone, offset, rotation }
  skillCheck = { "easy", "medium" }, loseOnFail = false, -- failed: nothing made (loseOnFail: ingredients lost)
  job = "mechanic",                                      -- or { mechanic = 2 }
  bench = "workshop",                                    -- or { "a", "b" }; nil: every bench and RLX.Craft
  maxCount = 5,                                          -- the player is asked how many
})
RLX.AddCraftingBench({ id = "workshop", label = "Workbench", coords = c, radius = 1.5,
  job = nil, recipes = nil, blip = { sprite = 566, color = 47 }, point = true })   -- point: "[E] Workbench"

RLX.OpenCrafting(source, "workshop")          -- the menu (from a target, an item, a key...): pick, how many, bar, skill check
RLX.Craft(source, "lockpick", 2)              -- no interface: true, or false and the reason
RLX.CanCraft(source, "lockpick", 1)           -- true, or false and { reason, missing = { { label, have, need } } }
RLX.GetRecipes("workshop")   RLX.RemoveRecipe(id)   RLX.RemoveCraftingBench(id)

The menu greys out what the player cannot make and shows, for each recipe, what it takes and how many they have. Hook craft (source, recipe, count, bench: cancel, or change count); event rlx:crafted (source, recipe, count, bench). A resource's recipes and benches go with it.