-- ScriptsCodes | Roblox Studio Luau utility -- Run: Open your own place in Roblox Studio, choose View > Command Bar, paste this file, and press Enter. -- Output: Results appear in the Studio Output window. Edit the sample values before running. -- Lua Clamp Function: constrain a number to an inclusive range local function clamp(value, minimum, maximum) assert(minimum <= maximum, "minimum must not exceed maximum") if value < minimum then return minimum end if value > maximum then return maximum end return value end for _, sample in ipairs({ -4, 0.5, 12 }) do print(sample, "->", clamp(sample, 0, 10)) end