Skip to main content

Overview

The set_calculated_property tool allows you to set property values using mathematical formulas. This is powerful for creating patterns, sequences, or calculations based on existing properties or custom variables.

Parameters

paths
array
required
Array of instance paths to modify. Each path uses dot notation (e.g., game.Workspace.Part1)
propertyName
string
required
Name of the property to set (e.g., Position, Transparency, Size)
formula
string
required
Mathematical formula to calculate the property value. Can reference existing properties and variables.Examples:
  • "index * 50" - Multiply instance index by 50
  • "Position.Y + 10" - Add 10 to current Y position
  • "size * 2" - Double a custom variable
  • "math.sin(index) * amplitude" - Sine wave pattern
variables
object
Additional variables available in the formula. Optional.Example:
{
  "amplitude": 5,
  "offset": 100,
  "scale": 2.5
}

Built-in Variables

The formula has access to these built-in variables:
  • index - The index of the current instance in the paths array (0-based)
  • Position - Current Position property (for Vector3 operations)
  • Size - Current Size property
  • Any current property of the instance can be referenced by name
  • math - Lua math library (sin, cos, abs, floor, ceil, etc.)

Vector3 Handling

When setting Vector3 properties, you can:
  1. Calculate entire Vector3: Return an object
    "formula": "{X = index * 10, Y = 5, Z = -index * 20}"
    
  2. Calculate single component: Use component notation
    "propertyName": "Position",
    "formula": "Position.Y + (index * 5)"
    
  3. Reference Vector3 properties: Access X, Y, Z components
    "formula": "Position.magnitude * 2"
    

Examples

Sequential positioning

Place platforms at increasing distances:
{
  "paths": [
    "game.Workspace.Platform1",
    "game.Workspace.Platform2",
    "game.Workspace.Platform3"
  ],
  "propertyName": "Position",
  "formula": "{X = 0, Y = 5, Z = -index * 50}"
}

Creating a transparency gradient

{
  "paths": [
    "game.Workspace.Part1",
    "game.Workspace.Part2",
    "game.Workspace.Part3",
    "game.Workspace.Part4"
  ],
  "propertyName": "Transparency",
  "formula": "index * 0.25"
}
Result: Part1=0, Part2=0.25, Part3=0.5, Part4=0.75

Sine wave pattern

{
  "paths": [
    "game.Workspace.Step1",
    "game.Workspace.Step2",
    "game.Workspace.Step3"
  ],
  "propertyName": "Position",
  "formula": "{X = index * spacing, Y = baseHeight + math.sin(index * freq) * amplitude, Z = 0}",
  "variables": {
    "spacing": 10,
    "baseHeight": 5,
    "freq": 0.5,
    "amplitude": 3
  }
}

Scaling based on position

{
  "paths": [
    "game.Workspace.Part1",
    "game.Workspace.Part2",
    "game.Workspace.Part3"
  ],
  "propertyName": "Size",
  "formula": "{X = baseSize * (1 + index * 0.2), Y = baseSize, Z = baseSize}",
  "variables": {
    "baseSize": 4
  }
}

Relative height adjustment

{
  "paths": [
    "game.Workspace.Platform1",
    "game.Workspace.Platform2",
    "game.Workspace.Platform3"
  ],
  "propertyName": "Position",
  "formula": "{X = Position.X, Y = Position.Y + (index * heightIncrement), Z = Position.Z}",
  "variables": {
    "heightIncrement": 2.5
  }
}

Alternating pattern

{
  "paths": [
    "game.Workspace.Light1",
    "game.Workspace.Light2",
    "game.Workspace.Light3",
    "game.Workspace.Light4"
  ],
  "propertyName": "Brightness",
  "formula": "(index % 2 == 0) and maxBright or minBright",
  "variables": {
    "maxBright": 1,
    "minBright": 0.2
  }
}

Use Cases

  • Creating evenly spaced object patterns
  • Generating gradients (transparency, color, size)
  • Building staircases with calculated heights
  • Creating wave or spiral patterns
  • Applying mathematical sequences to properties
  • Generating procedural variations

Formula Tips

  • Use index for sequence-based calculations
  • Access current property values directly by name
  • Lua math functions are available via math.function()
  • For Vector3 results, use table notation: {X = expr, Y = expr, Z = expr}
  • Use ternary operators for conditional values: (condition) and valueIfTrue or valueIfFalse

Error Handling

If the formula has syntax errors or references undefined variables, the operation will fail. Always test formulas on a small subset of instances first.

Build docs developers (and LLMs) love