Skip to main content

RSG Framework Patterns

These are the most common patterns you’ll use when developing for RSG Framework. Master these and you’ll write better, more reliable code!

Pattern 1: Get Core Object

Every RSG resource starts with this:
Always use local when getting the core object to avoid conflicts!
Complete Example:

Pattern 2: Player Validation (Server)

Always validate the player exists before doing operations:
Complete Example with Multiple Checks:

Pattern 3: Inventory Operations

Adding Items (Server)

Removing Items (Server)

Checking Items (Server)


Pattern 4: Money Operations (Server)

Complete Payment Example:

Pattern 5: Job/Gang Checks

Check Player’s Job (Server)

Check Player’s Job (Client)

Complete Job-Restricted Example:

Pattern 6: Notifications

Using ox_lib notify (modern way):
On Server (send to client):

Pattern 7: Distance Checks

Client-Side Distance Check

Server-Side Distance Check


Pattern 8: Useable Items

Register items that can be used:
With Animation (Client):

Pattern 9: Commands

Basic Command

Command with Arguments

Admin Command


Pattern 10: ox_lib Input Dialogs

Get user input with validation:

Pattern 11: Progress Bars

Show progress for actions:

Pattern 12: Context Menus

Create interactive menus:

Pattern 13: Target System (ox_target)

Add interactive zones/entities:

Pattern 14: Cleanup on Resource Stop

Always clean up when resource stops:

Summary: Essential Patterns Checklist

  1. Always get RSGCore object with local
  2. Always validate Player exists on server
  3. Always check inventory space before adding items
  4. Always check money/items before removing
  5. Always validate client input on server
  6. Always use appropriate Wait() times in loops
  7. Always clean up on resource stop
  8. Always use lib.notify for user feedback

Next Steps


Need more help? Join the RSG Framework Discord!