Scripting / API
Math & Task Utilities
Random numbers, coherent noise and basic timing helpers available to Glorpia Luau.
Infinity
infinf is the positive-infinity numeric value. Use -inf for negative infinity. Scalar number properties can use infinity when their property range permits it. Integer properties convert infinity to the corresponding integer limit.
math.random()
math.random()math.random(max)math.random(min, max)| Name | Type | Description |
|---|---|---|
no arguments | number | Returns a pseudo-random number from 0 up to but not including 1. |
max | integer | Returns an integer from 1 through max. |
min, max | integer | Returns an integer in the inclusive range. |
Luau
local roll = math.random(1, 6)
print("Rolled", roll)math.noise()
math.noise(x, y?, z?)Returns deterministic, smoothly interpolated coherent noise in approximately the -1 to 1 range. Missing Y or Z coordinates default to 0.
Luau
for x = 0, 5 do
local value = math.noise(x * 0.15, 0, 0)
print(x, value)
endtask.wait()
task.wait(seconds?)| Name | Type | Description |
|---|---|---|
seconds | number? | Requested delay. Defaults to about one frame. |
return | number | Actual elapsed wait time in seconds. |
Luau
print("before")
task.wait(0.5)
print("after")