Values
Typed single-value objects used to expose configuration to scripts.
| Class | Holds |
|---|---|
StringValue | string, up to 1000 characters |
IntValue | Integer |
NumberValue | Floating-point number |
BoolValue | boolean |
Vector3Value | Vector3 |
Numeric values are clamped to ±1,000,000,000. In Studio, insert a value by right-clicking a part, model, script or Storage and choosing New IntValue or another type. See Settings with values.
local damage = script.Damage.Value
local health = script.Parent.Health.ValueServer only
Value objects are not replicated to clients. To expose a value to clients, mirror it into State.
Properties
Value
value.Value: string | number | boolean | Vector3The stored value. Assigning a value of the wrong type raises an error.
script.Score.Value = script.Score.Value + 1Name
value.Name: stringObject name. value.ClassName returns the class, for example "IntValue".
Parent
value.Parent: Script | Part | Model | Value | WorldThe containing object. Assign to reparent the value, including under a script.
Methods
Destroy
value:Destroy()Removes the value and its child values.
FindFirstChild
value:FindFirstChild(name: string): Value?Returns the child value with the given name, or nil.
GetChildren
value:GetChildren(): { Value }Returns the child values.
Events
Changed
value.Changed(newValue: any)Fires when Value changes, with the new value.
script.Score.Changed:Connect(function(newValue)
print("Score is now", newValue)
end)Toolbox configuration
Toolbox models expose their tunable parameters as value objects.
| Model | Values |
|---|---|
| Zombie | Health, Speed, Damage |
| Respawning Zombie | Health, Speed, Damage, RespawnTime |
| Sword | Damage, Reach |
| RPG | Damage, BlastRadius, BlastForce, ReloadTime |
| Sprint System | SprintSpeed, WalkSpeed |
| Round System | LobbyTime, RoundTime, MinPlayers, LobbyPosition, MapPosition, MapsFolder |
| Speed Pad | Speed, Duration, NormalSpeed |
| Coin | Amount, RespawnTime |
| Doors | OpenTime |