Events
Stress state bags and server events available in orbit-dynamichud-stress.
Events
Stress is stored as a replicated state bag value from 0 to 100.
Use the server events when you want the stress resource to handle clamping and whitelist checks. Read the state bag when you only need to display or react to the current value.
Server owns replicated stress
Prefer server events or a server-side player-state write for gameplay changes. A client should request a change rather than treating a local-only assignment as authoritative.
local stress = LocalPlayer.state.stress or 0local src = source
local stress = Player(src)?.state?.stress or 0
Player(src)?.state:set("stress", 25, true)Prop
Type
Client integration
TriggerServerEvent('hud:server:GainStress', 10)
TriggerServerEvent('hud:server:RelieveStress', 15)Use client triggers for gameplay actions that happen locally, such as a minigame failure, consuming an item, or a custom vehicle script detecting stressful behavior.
Server-side admin or script integration
local src = 12
local stress = math.max(0, math.min(100, 25))
Player(src)?.state:set("stress", stress, true)Use direct state writes when server code already knows the target player ID, such as an admin command or another server-only system. Clamp the value yourself so it stays between 0 and 100.
hud:server:GainStress clamps at 100. hud:server:RelieveStress clamps at 0. hud:server:GainStress also checks Config.Stress.whitelistedJobs.
Integration checklist
- Validate and clamp externally calculated values to
0-100. - Use
hud:server:GainStresswhen the configured job whitelist should apply. - Use
hud:server:RelieveStressfor normal relief so the addon owns the resulting state. - Use direct replicated state writes only when server code intentionally bypasses normal gain/relief policy.
- Avoid triggering an event and writing the resulting state for the same action, which applies the change twice.