Skip to main content
px_discord is designed to be plug-and-play with minimal setup. All configuration is handled through: config/server.lua This file controls how Discord connections are handled, how roles are validated, and how access permissions are enforced across players. Once installed, simply start the resource: ensure px_discord Everything else is handled automatically by the system.

Core Settings

These values define how px_discord connects to Discord and validates player permissions.

Role Gate

px_discord supports optional role-based access control to restrict server entry.

Role Mode Behavior

When Mode = ‘any’:
  • Player must have at least one listed role
  • Most common setup
  • Suitable for verification or membership systems
When Mode = ‘all’:
  • Player must have every listed role
  • Used for strict permission environments
  • Suitable for private or staff-only servers

How It Works

The system runs entirely server-side and handles all Discord communication securely.

Connection Flow

  • The resource initializes using your configured Discord bot token
  • Guild validation ensures the bot is connected to the correct server
  • Player Discord identifiers are detected automatically
  • Role data is requested and validated against configured requirements

Role Validation Flow

  • Discord roles are fetched using secure API requests
  • Role data is cached to reduce unnecessary requests
  • Players are approved or denied based on configured role logic
  • Access decisions are handled entirely server-side

Permission Handling

  • All validation runs before player access is granted
  • No client-side role checks are required
  • Permissions stay consistent across reconnects

Fallback Behavior

If the Discord API fails or returns invalid data:
  • Cached role data is used when available
  • Players are temporarily restricted if validation cannot be completed
  • The system retries automatically on the next request cycle
On initial startup, the system verifies configuration values before allowing connections.

Performance

px_discord is designed to remain lightweight and efficient.
  • Role data is cached to reduce API usage
  • Requests are interval-based, not constant
  • Minimal memory usage during validation
  • Fully server-driven logic with optimized handling

Debug Mode

When enabled, the script prints useful logs for:
  • Discord connection checks
  • Role validation results
  • Access decisions
  • API response handling
This mode is recommended during setup and testing.